data-diverse
Extensible records and polymorphic variants.
https://github.com/louispan/data-diverse#readme
| Version on this page: | 4.7.0.0 |
| LTS Haskell 24.16: | 4.7.1.0 |
| Stackage Nightly 2025-10-22: | 4.7.1.0 |
| Latest on Hackage: | 4.7.1.0 |
data-diverse-4.7.0.0@sha256:0eacb57ad22171bd77b05cc9677cdfc74fd6c018000e4db87f77edd47928c526,3195Module documentation for 4.7.0.0
- Data
“Data.Diverse.Many” is an extensible record for any size encoded efficiently as (Seq Any).
“Data.Diverse.Which” polymorphic variant of possibilities encoded as (Int, Any).
Provides getters, setters, projection, injection, folds, and catamorphisms; accessed by type or index or label.
Refer to ManySpec.hs and WhichSpec.hs for example usages.
Iso, Lens and Prisms are provided in data-diverse-lens
Changelog
-
4.6.0.0
- Renamed
definitelytototally.
- Renamed
-
4.5.0.0
- Replaced usages of
KnownNatwith a newNatToIntclass to avoid inefficient Integer https://github.com/louispan/data-diverse/issues/8.
- Replaced usages of
-
4.4.0.0
- Renamed
UnconstrainedtoC0. AddedC2,C3,C4,C5,C6.
- Renamed
-
4.3.0.0
- Renamed
NoConstrainttoUnconstrained
- Renamed
-
4.2.0.0
- Added
CaseFunc1to allowafmapof withFunctor, etc. Whichis now also an instance ofAFoldable.- Added
NoConstraintwhich is useful forCaseFunc1for unused constraints. - Added
definitely.
- Added
-
4.1.0.0
- Removed
zilch.
- Removed
-
4.0.0.0
- Renamed
prefixtoconsManyandpostfixtosnocMany.
- Renamed
-
3.1.0.0
- Removed
Readinstance forWhich []since it is uninhabitable. xxxTagfunctions only rely onUniqueMember, notUniqueLabelMember
- Removed
-
3.0.0.0
- Renamed
fetchtograbto avoid conflicting with Haxl. - Removed unused type functions from removed splitting functions (Before,To,After,From,Length)
- Added
impossible'and ability to diversify and reinterpretWhich '[Void] - Added
zilch - Removed
CanAppendUnique(not useful).
- Renamed
-
2.0.1.0
- Simplified type synonyms for
Which. AddedReinterpretedconstraint synonym.
- Simplified type synonyms for
-
2.0.0.0
- Breaking change: the prime (xxx’) version of functions are now consistently the simpler or non-polymorphic version.
- This is more consistent with
Control.Lensas well. - This means the following are swapped:
replace,replace'replaceL,replaceL'replaceTag,replaceTag'replaceN,replaceN'amend,amend'amendL,amendL'amendN,amendN'
- This is more consistent with
- Breaking change: Removed proxy argument from
fetchL/Tag/N,replaceXXX,selectL/Tag/N,amendXXX,pickL/Tag/N,trialL/Tag/Nrelying soley onTypeApplicationsand now requiringAllowAmbiguousTypes. TheProxyis also removed from the Read/Show serialized format. - Rearranged type variables in
fetchL/N,replaceL/Tag/N,pickL/Tag/N,trialL/Tag/Ntype parameters, so the type variable ordering is consistently label, orig to change, smaller to larger, ie.l/n,x,y,xs
- Breaking change: the prime (xxx’) version of functions are now consistently the simpler or non-polymorphic version.
-
1.3.0.0
- Removed splitting operations added in 1.2.0.0
- added
xxxTagversion of label operations that also automatically untags the field.
-
1.2.0.3
PolyKindsforWhich- Removed cabal upper bounds
-
1.2.0.2
- Added
insert/removefor GHC < 8.2 - Removed type functions
UniqueMemberAt,MaybeUniqueMemberAt
- Added
-
1.2.0.1
insert/removeis not available in GHC 8.2 onwards.
-
1.2.0.0
- Rerranged type variable for xxxL and xxxN functions so that the
xinferrred from labellor indexnis afterproxy.- This affects
fetch[L|N],replace[L|N],replace[L|N]',pick[L|N]
- This affects
- Depends on at least containers-0.5.8.2 for
Data.Sequence.insertAt - Added splitting operations:
split[Before|After][|L|N],inset[Before|After][|L|N],insert[Before|After][|L|N],remove[Before|After][|L|N] - Renamed type function
WithouttoRemoveto be consistent with newremovemethod.
- Rerranged type variable for xxxL and xxxN functions so that the
-
1.1.0.0
- Added
CaseFuncandCaseFunc'which replacesCaseTypeable(egCaseFunc @Typeable) https://github.com/louispan/data-diverse/issues/6 - Replaced
IsAllconstraint withAllConstrained.
- Added
-
1.0.0.1
- Added
CaseTypeable'as an example of polymorphicCasethat doesn’t change the type.
- Added
-
1.0.0.0
- The exposed api shouldn’t break, but there are a lot of internal changes.
- Added
AFunctorwhich can map over the types in the ‘Many’ https://github.com/louispan/data-diverse/issues/5. - Added friendlier type synomyns
CollectandCollectNforcollectandcollectN - Expose type of ‘Collector’ and ‘CollectorN’
- Replace type parameter
rfromCasetypeclass withCaseResulttype family. - Replaced
CasesResulttype function withIsAllandCasesResultstype functions. - All
CaseXxxtype variables now end with r xs. - All
CaseXxxNtype variables now end with r n xs.
-
0.11.0.0
- Added
impossiblemodelled afterData.Void.absurdhttps://github.com/louispan/data-diverse/issues/4 - Removed
zilchsoWhich '[]is uninhabited likeData.Void.Void, making ‘impossible’ safe to use. - Removed
Monoidand changedShow,ReadandGenericinstances forWhich '[]to be partial just like Data.Void.Void. - Added
instance Reduce (Which '[]) (Switcher c '[] r), which follows fromimpossible.
- Added
-
0.10.0.0
- Renamed
SwitchtoSwitcher. Switch is now a type synonym forswitchconstraints - Added CasesResult type family to help infer the result of
cases - Added Semigroup and Monoid instances for all Many xs.
- Added Maybe versions of trial, and reinterpret
- Renamed
reinterpetNtoreinterpretN' - Renamed
impossibletozilch. - Allowed
reintepreting anddiversifyingzilchtozilch - Removed zipped type variable from
Amendconstraints. - Removed r type variable from
Reducetypeclass. - Rearranged type variables in
fetch,replace,pick,trial,Diversifytype parameters, so the type variable ordering is consistently smaller to larger, ie.x,xs,branch,tree - Added
diversify'for allowing rearranging the types only.
- Renamed
-
0.9.0.1
- Fixed GHC 8.2.1 test failure due to changed TypeRep show instance.
-
0.9.0.0
- Breaking changes: Renamed Many.sliceL/R to Many.viewf/b
- Renamed TypeLevel.Internal.MissingImpl to IsUniqueImpl.
- Added postifx’ with SnocUnique and append’ with AppendUnique.
- Added Semigroup & Monoid instances for
Many '[]andWhich '[] - Fixed GHC 8.2 compile error with importing GHC.Prim (Any)
-
0.8.1.0
- Added NFData instance for Which.
- Forgot to expose Many.sliceL and Many.sliceR.
-
0.8.0.0
- Changed internal representation to (Data.Seq Any) for a further 2x append speedup.
- Added NFData instance for Many.
-
0.7.0.0
- Removed NOINLINE pragmas.
- Changed internal representation to (Int, Data.IntMap Any) for a 2.5x append speedup.
-
0.6.0.0
- Moved lens to data-diverse-lens
-
0.5.0.0
- Renamed type level functions module from Type to TypeLevel
-
0.4.0.0
- Removed Emit typeclass, breaking renames. Added label accessors.
-
0.1.0.0
- Initial version represented as (Int, Data.Map Int Any)
Changes
Changelog
-
4.7.0.0
- Removed
totally. AddedCaseFunc1_
- Removed
-
4.6.0.0
- Renamed
definitelytototally.
- Renamed
-
4.5.0.0
- Replaced usages of
KnownNatwith a newNatToIntclass to avoid inefficient Integer https://github.com/louispan/data-diverse/issues/8.
- Replaced usages of
-
4.4.0.0
- Renamed
UnconstrainedtoC0. AddedC2,C3,C4,C5,C6.
- Renamed
-
4.3.0.0
- Renamed
NoConstrainttoUnconstrained
- Renamed
-
4.2.0.0
- Added
CaseFunc1to allowafmapof withFunctor, etc. Whichis now also an instance ofAFoldable.- Added
NoConstraintwhich is useful forCaseFunc1for unused constraints. - Added
definitely.
- Added
-
4.1.0.0
- Removed
zilch.
- Removed
-
4.0.0.0
- Renamed
prefixtoconsManyandpostfixtosnocMany.
- Renamed
-
3.1.0.0
- Removed
Readinstance forWhich []since it is uninhabitable. xxxTagfunctions only rely onUniqueMember, notUniqueLabelMember
- Removed
-
3.0.0.0
- Renamed
fetchtograbto avoid conflicting with Haxl. - Removed unused type functions from removed splitting functions (Before,To,After,From,Length)
- Added
impossible'and ability to diversify and reinterpretWhich '[Void] - Added
zilch - Removed
CanAppendUnique(not useful).
- Renamed
-
2.0.1.0
- Simplified type synonyms for
Which. AddedReinterpretedconstraint synonym.
- Simplified type synonyms for
-
2.0.0.0
- Breaking change: the prime (xxx’) version of functions are now consistently the simpler or non-polymorphic version.
- This is more consistent with
Control.Lensas well. - This means the following are swapped:
replace,replace'replaceL,replaceL'replaceTag,replaceTag'replaceN,replaceN'amend,amend'amendL,amendL'amendN,amendN'
- This is more consistent with
- Breaking change: Removed proxy argument from
fetchL/Tag/N,replaceXXX,selectL/Tag/N,amendXXX,pickL/Tag/N,trialL/Tag/Nrelying soley onTypeApplicationsand now requiringAllowAmbiguousTypes. TheProxyis also removed from the Read/Show serialized format. - Rearranged type variables in
fetchL/N,replaceL/Tag/N,pickL/Tag/N,trialL/Tag/Ntype parameters, so the type variable ordering is consistently label, orig to change, smaller to larger, ie.l/n,x,y,xs
- Breaking change: the prime (xxx’) version of functions are now consistently the simpler or non-polymorphic version.
-
1.3.0.0
- Removed splitting operations added in 1.2.0.0
- added
xxxTagversion of label operations that also automatically untags the field.
-
1.2.0.3
PolyKindsforWhich- Removed cabal upper bounds
-
1.2.0.2
- Added
insert/removefor GHC < 8.2 - Removed type functions
UniqueMemberAt,MaybeUniqueMemberAt
- Added
-
1.2.0.1
insert/removeis not available in GHC 8.2 onwards.
-
1.2.0.0
- Rerranged type variable for xxxL and xxxN functions so that the
xinferrred from labellor indexnis afterproxy.- This affects
fetch[L|N],replace[L|N],replace[L|N]',pick[L|N]
- This affects
- Depends on at least containers-0.5.8.2 for
Data.Sequence.insertAt - Added splitting operations:
split[Before|After][|L|N],inset[Before|After][|L|N],insert[Before|After][|L|N],remove[Before|After][|L|N] - Renamed type function
WithouttoRemoveto be consistent with newremovemethod.
- Rerranged type variable for xxxL and xxxN functions so that the
-
1.1.0.0
- Added
CaseFuncandCaseFunc'which replacesCaseTypeable(egCaseFunc @Typeable) https://github.com/louispan/data-diverse/issues/6 - Replaced
IsAllconstraint withAllConstrained.
- Added
-
1.0.0.1
- Added
CaseTypeable'as an example of polymorphicCasethat doesn’t change the type.
- Added
-
1.0.0.0
- The exposed api shouldn’t break, but there are a lot of internal changes.
- Added
AFunctorwhich can map over the types in the ‘Many’ https://github.com/louispan/data-diverse/issues/5. - Added friendlier type synomyns
CollectandCollectNforcollectandcollectN - Expose type of ‘Collector’ and ‘CollectorN’
- Replace type parameter
rfromCasetypeclass withCaseResulttype family. - Replaced
CasesResulttype function withIsAllandCasesResultstype functions. - All
CaseXxxtype variables now end with r xs. - All
CaseXxxNtype variables now end with r n xs.
-
0.11.0.0
- Added
impossiblemodelled afterData.Void.absurdhttps://github.com/louispan/data-diverse/issues/4 - Removed
zilchsoWhich '[]is uninhabited likeData.Void.Void, making ‘impossible’ safe to use. - Removed
Monoidand changedShow,ReadandGenericinstances forWhich '[]to be partial just like Data.Void.Void. - Added
instance Reduce (Which '[]) (Switcher c '[] r), which follows fromimpossible.
- Added
-
0.10.0.0
- Renamed
SwitchtoSwitcher. Switch is now a type synonym forswitchconstraints - Added CasesResult type family to help infer the result of
cases - Added Semigroup and Monoid instances for all Many xs.
- Added Maybe versions of trial, and reinterpret
- Renamed
reinterpetNtoreinterpretN' - Renamed
impossibletozilch. - Allowed
reintepreting anddiversifyingzilchtozilch - Removed zipped type variable from
Amendconstraints. - Removed r type variable from
Reducetypeclass. - Rearranged type variables in
fetch,replace,pick,trial,Diversifytype parameters, so the type variable ordering is consistently smaller to larger, ie.x,xs,branch,tree - Added
diversify'for allowing rearranging the types only.
- Renamed
-
0.9.0.1
- Fixed GHC 8.2.1 test failure due to changed TypeRep show instance.
-
0.9.0.0
- Breaking changes: Renamed Many.sliceL/R to Many.viewf/b
- Renamed TypeLevel.Internal.MissingImpl to IsUniqueImpl.
- Added postifx’ with SnocUnique and append’ with AppendUnique.
- Added Semigroup & Monoid instances for
Many '[]andWhich '[] - Fixed GHC 8.2 compile error with importing GHC.Prim (Any)
-
0.8.1.0
- Added NFData instance for Which.
- Forgot to expose Many.sliceL and Many.sliceR.
-
0.8.0.0
- Changed internal representation to (Data.Seq Any) for a further 2x append speedup.
- Added NFData instance for Many.
-
0.7.0.0
- Removed NOINLINE pragmas.
- Changed internal representation to (Int, Data.IntMap Any) for a 2.5x append speedup.
-
0.6.0.0
- Moved lens to data-diverse-lens
-
0.5.0.0
- Renamed type level functions module from Type to TypeLevel
-
0.4.0.0
- Removed Emit typeclass, breaking renames. Added label accessors.
-
0.1.0.0
- Initial version represented as (Int, Data.Map Int Any)
