Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Useful utilities we need accross multiple modules.
- (&&&) :: Arrow a => forall b c c'. a b c -> a b c' -> a b (c, c')
- (***) :: Arrow a => forall b c b' c'. a b c -> a b' c' -> a (b, b') (c, c')
- type (:->) f g = forall n. f n -> g n
- (<.>) :: Monad m => (b -> m c) -> (a -> m b) -> a -> m c
- data Product k (f :: k -> *) (g :: k -> *) (a :: k) :: forall k. (k -> *) -> (k -> *) -> k -> * = Pair (f a) (g a)
- type (:*:) = Product
- pattern (:*:) :: f a -> g a -> Product f g a
- type Delta f = Product f f
- curry' :: (Product f g x -> a) -> f x -> g x -> a
- uncurry' :: (f x -> g x -> a) -> Product f g x -> a
- delta :: f :-> Delta f
- data Sum k (f :: k -> *) (g :: k -> *) (a :: k) :: forall k. (k -> *) -> (k -> *) -> k -> *
- either' :: (f :-> r) -> (g :-> r) -> Sum f g :-> r
- either'' :: (forall x. f x -> a) -> (forall y. g y -> a) -> Sum f g r -> a
- data Nat
- proxyUnsuc :: Proxy (S n) -> Proxy n
- data SNat :: Nat -> * where
- snat2int :: SNat n -> Integer
- class IsNat (n :: Nat) where
- getNat :: IsNat n => Proxy n -> Integer
- getSNat' :: forall (n :: Nat). IsNat n => SNat n
- data ListPrf :: [k] -> * where
- class IsList (xs :: [k]) where
- type L1 xs = IsList xs
- type L2 xs ys = (IsList xs, IsList ys)
- type L3 xs ys zs = (IsList xs, IsList ys, IsList zs)
- type L4 xs ys zs as = (IsList xs, IsList ys, IsList zs, IsList as)
- type family (txs :: [k]) :++: (tys :: [k]) :: [k] where ...
- appendIsListLemma :: ListPrf xs -> ListPrf ys -> ListPrf (xs :++: ys)
- type family Lkup (n :: Nat) (ks :: [k]) :: k where ...
- type family Idx (ty :: k) (xs :: [k]) :: Nat where ...
- data El :: [*] -> Nat -> * where
- getElSNat :: forall ix ls. El ls ix -> SNat ix
- into :: forall fam ty ix. (ix ~ Idx ty fam, Lkup ix fam ~ ty, IsNat ix) => ty -> El fam ix
- class EqHO (f :: ki -> *) where
- class ShowHO (f :: ki -> *) where
Utility Functions and Types
(&&&) :: Arrow a => forall b c c'. a b c -> a b c' -> a b (c, c') infixr 3 #
Fanout: send the input to both argument arrows and combine their output.
The default definition may be overridden with a more efficient version if desired.
(***) :: Arrow a => forall b c b' c'. a b c -> a b' c' -> a (b, b') (c, c') infixr 3 #
Split the input between the two argument arrows and combine their output. Note that this is in general not a functor.
The default definition may be overridden with a more efficient version if desired.
Poly-kind indexed product functionality
data Product k (f :: k -> *) (g :: k -> *) (a :: k) :: forall k. (k -> *) -> (k -> *) -> k -> * #
Lifted product of functors.
Pair (f a) (g a) |
Generic1 k (Product k f g) | |
(ShowHO ki f, ShowHO ki g) => ShowHO ki (Product ki f g) Source # | |
(EqHO ki f, EqHO ki g) => EqHO ki (Product ki f g) Source # | |
(Monad f, Monad g) => Monad (Product * f g) | Since: 4.9.0.0 |
(Functor f, Functor g) => Functor (Product * f g) | Since: 4.9.0.0 |
(MonadFix f, MonadFix g) => MonadFix (Product * f g) | Since: 4.9.0.0 |
(Applicative f, Applicative g) => Applicative (Product * f g) | Since: 4.9.0.0 |
(Foldable f, Foldable g) => Foldable (Product * f g) | Since: 4.9.0.0 |
(Traversable f, Traversable g) => Traversable (Product * f g) | Since: 4.9.0.0 |
(Eq1 f, Eq1 g) => Eq1 (Product * f g) | Since: 4.9.0.0 |
(Ord1 f, Ord1 g) => Ord1 (Product * f g) | Since: 4.9.0.0 |
(Read1 f, Read1 g) => Read1 (Product * f g) | Since: 4.9.0.0 |
(Show1 f, Show1 g) => Show1 (Product * f g) | Since: 4.9.0.0 |
(MonadZip f, MonadZip g) => MonadZip (Product * f g) | Since: 4.9.0.0 |
(Alternative f, Alternative g) => Alternative (Product * f g) | Since: 4.9.0.0 |
(MonadPlus f, MonadPlus g) => MonadPlus (Product * f g) | Since: 4.9.0.0 |
(Eq1 f, Eq1 g, Eq a) => Eq (Product * f g a) | Since: 4.9.0.0 |
(Data (g a), Data (f a), Typeable * k, Typeable (k -> *) g, Typeable (k -> *) f, Typeable k a) => Data (Product k f g a) | |
(Ord1 f, Ord1 g, Ord a) => Ord (Product * f g a) | Since: 4.9.0.0 |
(Read1 f, Read1 g, Read a) => Read (Product * f g a) | Since: 4.9.0.0 |
(Show1 f, Show1 g, Show a) => Show (Product * f g a) | Since: 4.9.0.0 |
Generic (Product k f g a) | |
type Rep1 k (Product k f g) | |
type Rep (Product k f g a) | |
Poly-kind indexed sums
data Sum k (f :: k -> *) (g :: k -> *) (a :: k) :: forall k. (k -> *) -> (k -> *) -> k -> * #
Lifted sum of functors.
Generic1 k (Sum k f g) | |
(ShowHO ki f, ShowHO ki g) => ShowHO ki (Sum ki f g) Source # | |
(EqHO ki f, EqHO ki g) => EqHO ki (Sum ki f g) Source # | |
(Functor f, Functor g) => Functor (Sum * f g) | Since: 4.9.0.0 |
(Foldable f, Foldable g) => Foldable (Sum * f g) | Since: 4.9.0.0 |
(Traversable f, Traversable g) => Traversable (Sum * f g) | Since: 4.9.0.0 |
(Eq1 f, Eq1 g) => Eq1 (Sum * f g) | Since: 4.9.0.0 |
(Ord1 f, Ord1 g) => Ord1 (Sum * f g) | Since: 4.9.0.0 |
(Read1 f, Read1 g) => Read1 (Sum * f g) | Since: 4.9.0.0 |
(Show1 f, Show1 g) => Show1 (Sum * f g) | Since: 4.9.0.0 |
(Eq1 f, Eq1 g, Eq a) => Eq (Sum * f g a) | Since: 4.9.0.0 |
(Data (g a), Data (f a), Typeable * k, Typeable (k -> *) g, Typeable (k -> *) f, Typeable k a) => Data (Sum k f g a) | |
(Ord1 f, Ord1 g, Ord a) => Ord (Sum * f g a) | Since: 4.9.0.0 |
(Read1 f, Read1 g, Read a) => Read (Sum * f g a) | Since: 4.9.0.0 |
(Show1 f, Show1 g, Show a) => Show (Sum * f g a) | Since: 4.9.0.0 |
Generic (Sum k f g a) | |
type Rep1 k (Sum k f g) | |
type Rep (Sum k f g a) | |
either'' :: (forall x. f x -> a) -> (forall y. g y -> a) -> Sum f g r -> a Source #
Just like either'
, but the result type is of kind Star
Type-level Naturals
Type-level Peano Naturals
Type-level Lists
data ListPrf :: [k] -> * where Source #
An inhabitant of ListPrf ls
is *not* a singleton!
It only proves that ls
is, in fact, a type level list.
This is useful since it enables us to pattern match on
type-level lists whenever we see fit.
class IsList (xs :: [k]) where Source #
The IsList
class allows us to construct
ListPrf
s in a straight forward fashion.
appendIsListLemma :: ListPrf xs -> ListPrf ys -> ListPrf (xs :++: ys) Source #
Concatenation of lists is also a list.
Type-level List Lookup
getElSNat :: forall ix ls. El ls ix -> SNat ix Source #
Convenient way to cast an El
index to term-level.
into :: forall fam ty ix. (ix ~ Idx ty fam, Lkup ix fam ~ ty, IsNat ix) => ty -> El fam ix Source #
Smart constructor into El
Higher-order Eq and Show
class EqHO (f :: ki -> *) where Source #
Higher order version of Eq
EqHO Kon Singl Source # | |
Eq a => EqHO ki (Const ki a) Source # | |
(EqHO ki f, EqHO ki g) => EqHO ki (Sum ki f g) Source # | |
(EqHO ki f, EqHO ki g) => EqHO ki (Product ki f g) Source # | |
EqHO kon ki => EqHO Nat (Fix kon ki codes) Source # | |
EqHO k phi => EqHO [k] (NS k phi) Source # | |
EqHO k phi => EqHO [k] (NP k phi) Source # | |
(EqHO Nat phi, EqHO kon ki) => EqHO [[Atom kon]] (Rep kon ki phi) Source # | |
(EqHO Nat phi, EqHO kon ki) => EqHO (Atom kon) (NA kon ki phi) Source # | |
class ShowHO (f :: ki -> *) where Source #
Higher order version of Show
ShowHO Kon Singl Source # | |
Show a => ShowHO ki (Const ki a) Source # | |
(ShowHO ki f, ShowHO ki g) => ShowHO ki (Sum ki f g) Source # | |
(ShowHO ki f, ShowHO ki g) => ShowHO ki (Product ki f g) Source # | |
ShowHO [Atom kon] (ConstructorInfo kon) Source # | |
ShowHO (Atom kon) (FieldInfo kon) Source # | |
ShowHO k phi => ShowHO [k] (NS k phi) Source # | |
ShowHO k phi => ShowHO [k] (NP k phi) Source # | |
(ShowHO Nat phi, ShowHO kon ki) => ShowHO (Atom kon) (NA kon ki phi) Source # | |