data-diverse 1.0.0.0 → 1.0.0.1
raw patch · 3 files changed
+20/−1 lines, 3 filesPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
API changes (from Hackage documentation)
+ Data.Diverse.CaseTypeable: CaseTypeable' :: (forall x. Typeable x => x -> x) -> CaseTypeable'
+ Data.Diverse.CaseTypeable: instance Data.Diverse.Reiterate.Reiterate Data.Diverse.CaseTypeable.CaseTypeable' xs
+ Data.Diverse.CaseTypeable: instance Data.Typeable.Internal.Typeable x => Data.Diverse.Case.Case Data.Diverse.CaseTypeable.CaseTypeable' (x : xs)
+ Data.Diverse.CaseTypeable: newtype CaseTypeable' (xs :: [Type])
Files
- README.md +3/−0
- data-diverse.cabal +1/−1
- src/Data/Diverse/CaseTypeable.hs +16/−0
README.md view
@@ -14,6 +14,9 @@ # Changelog +* 1.0.0.1+ - Added `CaseTypeable'` as an example of polymorphic `Case` that doesn't change the type.+ * 1.0.0.0 - The exposed api shouldn't break, but there are a lot of internal changes. - Added `AFunctor` which can map over the types in the 'Many' <https://github.com/louispan/data-diverse/issues/5>.
data-diverse.cabal view
@@ -1,5 +1,5 @@ name: data-diverse-version: 1.0.0.0+version: 1.0.0.1 synopsis: Extensible records and polymorphic variants. description: "Data.Diverse.Many" is an extensible record for any size encoded efficiently as (Seq Any). "Data.Diverse.Which" is a polymorphic variant of possibilities encoded as (Int, Any).
src/Data/Diverse/CaseTypeable.hs view
@@ -16,6 +16,8 @@ import Data.Typeable -- | This handler stores a polymorphic function for all Typeables.+-- This is an example of how to define and instance of 'Case' for+-- polymorphic function into a specified result type. -- -- @ -- let y = 'Data.Diverse.Which.pick' (5 :: Int) :: 'Data.Diverse.Which.Which' '[Int, Bool]@@ -36,3 +38,17 @@ instance Typeable x => Case (CaseTypeable r) (x ': xs) where case' (CaseTypeable f) = f+++-- | This handler stores a polymorphic function for all Typeables.+-- This is an example of how to define and instance of 'Case' for+-- polymorphic function that doesn't change the type+newtype CaseTypeable' (xs :: [Type]) = CaseTypeable' (forall x. Typeable x => x -> x)++type instance CaseResult CaseTypeable' x = x++instance Reiterate CaseTypeable' xs where+ reiterate (CaseTypeable' f) = CaseTypeable' f++instance Typeable x => Case CaseTypeable' (x ': xs) where+ case' (CaseTypeable' f) = f