universe-base-1.1.3: A class for finite and recursively enumerable types.
Safe Haskell Safe
Language Haskell2010

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 #

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]
[]