wakame-0.1.0.0: Functions to manipulate records

Safe HaskellNone
LanguageHaskell2010

Wakame.Union

Synopsis

Documentation

>>> import GHC.Generics
>>> import Wakame
>>> data Point = Point { x :: Double, y :: Double } deriving (Show, Generic)
>>> pt = Point 1.2 8.3

class u ~ (l ++ r) => Union l r u | l r -> u where Source #

Typeclass for composing fields

>>> union (toRow pt) (toRow (keyed @"z" 42.0))
(x: 1.2) :* (y: 8.3) :* (z: 42.0) :* Nil
>>> ununion (toRow pt) :: (Row '[ '("x", Double)], Row '[ '("y", Double)])
((x: 1.2) :* Nil,(y: 8.3) :* Nil)
>>> ununion (toRow pt) :: (Row '[], Row '[ '("x", Double), '("y", Double)])
(Nil,(x: 1.2) :* (y: 8.3) :* Nil)

Methods

union :: Row l -> Row r -> Row u Source #

ununion :: Row u -> (Row l, Row r) Source #

Instances
Union ([] :: [FIELD]) r r Source # 
Instance details

Defined in Wakame.Union

Methods

union :: Row [] -> Row r -> Row r Source #

ununion :: Row r -> (Row [], Row r) Source #

Union l r u => Union (x ': l) r (x ': u) Source # 
Instance details

Defined in Wakame.Union

Methods

union :: Row (x ': l) -> Row r -> Row (x ': u) Source #

ununion :: Row (x ': u) -> (Row (x ': l), Row r) Source #