| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Data.Finitary.Enum
Synopsis
- class Ord x => Enum x where
- describeEnum :: (Enum x, Cartesian p, Cocartesian p) => p x x
- eqDefault :: Enum x => x -> x -> Bool
- compareDefault :: Enum x => x -> x -> Ordering
- enumList :: Enum x => [x]
- enum :: (Enum x, Alternative f) => f x
- coenum :: (Enum x, Decidable f, Divisible f) => f x
- cardinality :: Enum x => proxy x -> Int
- ptraverseFunction :: (Enum x, Cartesian p) => p a b -> p (x -> a) (x -> b)
Documentation
class Ord x => Enum x where Source #
Enum x is Finitary x but you can't get Cardinality n at type level.
Laws
The two functions f :: x -> Finite n and g :: Finite n -> x
obtained by withEnum must be isomorphism.
withEnum body = body f g g . f = id :: x -> x f . g = id :: Finite n -> Finite n
Additionally, two methods enumeration and withEnum must be
equivalent to the ones defined in terms of the other.
enumeration = withEnum makeFinFn withEnum body = withFinFn enumeration body
From these laws, applyFinFn enumeration = id must follow.
Minimal complete definition
Nothing
Methods
enumeration :: FinFn x x Source #
withEnum :: (forall (n :: Nat). KnownNat n => (x -> Finite n) -> (Finite n -> x) -> r) -> r Source #
Instances
describeEnum :: (Enum x, Cartesian p, Cocartesian p) => p x x Source #
compareDefault :: Enum x => x -> x -> Ordering Source #
enum :: (Enum x, Alternative f) => f x Source #
cardinality :: Enum x => proxy x -> Int Source #
ptraverseFunction :: (Enum x, Cartesian p) => p a b -> p (x -> a) (x -> b) Source #