Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Synopsis
- class GUniverse f where
- guniverse :: [f a]
- class GUniverseSum f where
- guniverseSum :: [[f a]]
- class GUniverseProduct f where
- guniverseProduct :: [f a]
- universeGeneric :: (Generic a, GUniverse (Rep a)) => [a]
Documentation
>>>
:set -XDeriveGeneric
>>>
import GHC.Generics
class GUniverse f where Source #
Instances
GUniverseSum f => GUniverse (M1 i c f) Source # | |
Defined in Data.Universe.Generic |
class GUniverseSum f where Source #
guniverseSum :: [[f a]] Source #
Instances
GUniverseSum (V1 :: Type -> Type) Source # | |
Defined in Data.Universe.Generic guniverseSum :: [[V1 a]] Source # | |
(GUniverseSum f, GUniverseSum g) => GUniverseSum (f :+: g) Source # | |
Defined in Data.Universe.Generic guniverseSum :: [[(f :+: g) a]] Source # | |
GUniverseProduct f => GUniverseSum (M1 i c f) Source # | |
Defined in Data.Universe.Generic guniverseSum :: [[M1 i c f a]] Source # |
class GUniverseProduct f where Source #
guniverseProduct :: [f a] Source #
Instances
GUniverseProduct (U1 :: Type -> Type) Source # | |
Defined in Data.Universe.Generic guniverseProduct :: [U1 a] Source # | |
Universe a => GUniverseProduct (K1 r a :: Type -> Type) Source # | |
Defined in Data.Universe.Generic guniverseProduct :: [K1 r a a0] Source # | |
(GUniverseProduct f, GUniverseProduct g) => GUniverseProduct (f :*: g) Source # | |
Defined in Data.Universe.Generic guniverseProduct :: [(f :*: g) a] Source # | |
GUniverseProduct f => GUniverseProduct (M1 i c f) Source # | |
Defined in Data.Universe.Generic 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]
[]