universe-base-1.1.3: A class for finite and recursively enumerable types.
Safe HaskellSafe
LanguageHaskell2010

Data.Universe.Generic

Synopsis

Documentation

>>> :set -XDeriveGeneric
>>> import GHC.Generics

class GUniverse f where Source #

Methods

guniverse :: [f a] Source #

Instances

Instances details
GUniverseSum f => GUniverse (M1 i c f) Source # 
Instance details

Defined in Data.Universe.Generic

Methods

guniverse :: [M1 i c f a] Source #

class GUniverseSum f where Source #

Methods

guniverseSum :: [[f a]] Source #

Instances

Instances details
GUniverseSum (V1 :: Type -> Type) Source # 
Instance details

Defined in Data.Universe.Generic

Methods

guniverseSum :: [[V1 a]] Source #

(GUniverseSum f, GUniverseSum g) => GUniverseSum (f :+: g) Source # 
Instance details

Defined in Data.Universe.Generic

Methods

guniverseSum :: [[(f :+: g) a]] Source #

GUniverseProduct f => GUniverseSum (M1 i c f) Source # 
Instance details

Defined in Data.Universe.Generic

Methods

guniverseSum :: [[M1 i c f a]] Source #

class GUniverseProduct f where Source #

Methods

guniverseProduct :: [f a] Source #

Instances

Instances details
GUniverseProduct (U1 :: Type -> Type) Source # 
Instance details

Defined in Data.Universe.Generic

Methods

guniverseProduct :: [U1 a] Source #

Universe a => GUniverseProduct (K1 r a :: Type -> Type) Source # 
Instance details

Defined in Data.Universe.Generic

Methods

guniverseProduct :: [K1 r a a0] Source #

(GUniverseProduct f, GUniverseProduct g) => GUniverseProduct (f :*: g) Source # 
Instance details

Defined in Data.Universe.Generic

Methods

guniverseProduct :: [(f :*: g) a] Source #

GUniverseProduct f => GUniverseProduct (M1 i c f) Source # 
Instance details

Defined in Data.Universe.Generic

Methods

guniverseProduct :: [M1 i c f a] Source #

universeGeneric :: (Generic a, GUniverse (Rep a)) => [a] Source #

>>> data One = One deriving (Show, Generic)
>>> universeGeneric :: [One]
[One]
>>> data Big = B0 Bool Bool | B1 Bool deriving (Show, Generic)
>>> universeGeneric :: [Big]
[B0 False False,B1 False,B0 False True,B1 True,B0 True False,B0 True True]
>>> universeGeneric :: [Maybe Ordering]
[Nothing,Just LT,Just EQ,Just GT]
>>> take 10 (universeGeneric :: [Either Integer Integer])
[Left 0,Right 0,Left 1,Right 1,Left (-1),Right (-1),Left 2,Right 2,Left (-2),Right (-2)]
>>> take 10 (universeGeneric :: [(Integer, Integer, Integer)])
[(0,0,0),(0,0,1),(1,0,0),(0,1,0),(1,0,1),(-1,0,0),(0,0,-1),(1,1,0),(-1,0,1),(2,0,0)]
>>> :set -XEmptyDataDeriving
>>> data Zero deriving (Show, Generic)
>>> universeGeneric :: [Zero]
[]