one-liner 0.2.1 → 0.2.2
raw patch · 3 files changed
+10/−5 lines, 3 filesdep ~basedep ~transformers
Dependency ranges changed: base, transformers
Files
- one-liner.cabal +2/−2
- src/Generics/OneLiner/ADT.hs +5/−2
- src/Generics/OneLiner/ADT1.hs +3/−1
one-liner.cabal view
@@ -1,5 +1,5 @@ Name: one-liner-Version: 0.2.1+Version: 0.2.2 Synopsis: Constraint-based generics Description: Write short and concise generic instances of type classes. Homepage: https://github.com/sjoerdvisscher/one-liner@@ -27,7 +27,7 @@ Build-depends: base >= 4.5 && < 5 - , transformers >= 0.3 && < 0.4+ , transformers >= 0.3 && < 0.5 , ghc-prim source-repository head
src/Generics/OneLiner/ADT.hs view
@@ -109,7 +109,7 @@ -- | The constraints needed to run `buildsA` and `buildsRecA`. -- It should be a list of all the types of the subcomponents of @t@, each applied to @c@.- type Constraints t c :: Constraint+ type Constraints t (c :: * -> Constraint) :: Constraint buildsA :: (Constraints t c, Applicative f) => For c -- ^ Witness for the constraint @c@.@@ -137,6 +137,8 @@ -- result of applicatively applying the constructor to the results of the given function -- for each field of the constructor. buildsRecA for sub _ = buildsA for sub+ + {-# MINIMAL ctorIndex, (buildsA | buildsRecA) #-} -- | Add an instance for this class if the data type has exactly one constructor. --@@ -187,6 +189,7 @@ + infixl 9 ! -- | Get the subcomponent by using the projector from the field information. (!) :: t -> FieldInfo (t -> s) -> s@@ -259,7 +262,7 @@ [ Left <$> f (FieldInfo (\(Left a) -> a)) , Right <$> f (FieldInfo (\(Right a) -> a)) ]-+ instance ADT (Maybe a) where ctorIndex Nothing = 0
src/Generics/OneLiner/ADT1.hs view
@@ -104,7 +104,7 @@ -- | The constraints needed to run `buildsA` and `buildsRecA`. -- It should be a list of all the types of the subcomponents of @t@, each applied to @c@.- type Constraints t c :: Constraint+ type Constraints t (c :: (* -> *) -> Constraint) :: Constraint buildsA :: (Constraints t c, Applicative f) => For c -- ^ Witness for the constraint @c@. -> (FieldInfo (Extract t) -> f b)@@ -125,6 +125,8 @@ -> (FieldInfo (t :~> t) -> f (t b)) -> [f (t b)] buildsRecA for param sub _ = buildsA for param sub+ + {-# MINIMAL ctorIndex, (buildsA | buildsRecA) #-} -- | Add an instance for this class if the data type has exactly one constructor. --