Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Data.Extend.Internal
Documentation
class GExtend a where Source #
Minimal complete definition
Instances
GExtend U1 Source # | |
Extend a => GExtend (K1 i a) Source # | |
(GExtend a, GExtend b) => GExtend ((:+:) a b) Source # | |
(GExtend (K1 i (m a)), Alternative m, GExtend b) => GExtend ((:*:) (K1 i (m a)) b) Source # | |
(GExtend a, GExtend b) => GExtend ((:*:) a b) Source # | |
GExtend a => GExtend (M1 i c a) Source # | |
Methods
extend :: a -> a -> a Source #
By default
a `extend` b = a
Nothing `extend` Just a = Just a
To use the Extend class, simply make your data derive Generic.
If "a" is a user defined data type, then all Nothing fields of "a" are replaced by corresponding fields in "b",
ie, all Just fields in "a" will override corresponding fields in "b".
extend :: (Generic a, GExtend (Rep a)) => a -> a -> a Source #
By default
a `extend` b = a
Nothing `extend` Just a = Just a
To use the Extend class, simply make your data derive Generic.
If "a" is a user defined data type, then all Nothing fields of "a" are replaced by corresponding fields in "b",
ie, all Just fields in "a" will override corresponding fields in "b".