Safe Haskell | Safe-Inferred |
---|

- data Monomorphic k = forall a . Monomorphic (k a)
- class Monomorphicable k where
- type MonomorphicRep k :: *
- promote :: MonomorphicRep k -> Monomorphic k
- demote :: Monomorphic k -> MonomorphicRep k

- demote' :: Monomorphicable k => k a -> MonomorphicRep k
- demoteComposed :: Monomorphicable (f :.: g) => f (g a) -> MonomorphicRep (f :.: g)
- monomorphicCompose :: f (g a) -> Monomorphic (f :.: g)
- withPolymorhic :: Monomorphicable k => MonomorphicRep k -> (forall a. k a -> b) -> b
- liftPoly :: Monomorphicable k => (forall a. k a -> b) -> MonomorphicRep k -> b
- viaPoly :: (Monomorphicable k, Monomorphicable k') => (forall x y. k x -> k' y) -> MonomorphicRep k -> MonomorphicRep k'
- newtype (f :.: g) a = Comp (f (g a))

# Documentation

data Monomorphic k Source

A wrapper type for polymophic types.

forall a . Monomorphic (k a) |

(Read (MonomorphicRep k k1), Monomorphicable k k1) => Read (Monomorphic k k1) | |

(Show (MonomorphicRep k k1), Monomorphicable k k1) => Show (Monomorphic k k1) |

class Monomorphicable k whereSource

A types which have the monomorphic representation.

type MonomorphicRep k :: *Source

Monomorphic representation

promote :: MonomorphicRep k -> Monomorphic kSource

Promote the monomorphic value to the polymophic one.

demote :: Monomorphic k -> MonomorphicRep kSource

Demote the polymorphic value to the monomorphic representation.

demote' :: Monomorphicable k => k a -> MonomorphicRep kSource

Convinience function to demote polymorphic types into monomorphic one directly.

demoteComposed :: Monomorphicable (f :.: g) => f (g a) -> MonomorphicRep (f :.: g)Source

Demote polymorphic nested types directly into monomorphic representation.

monomorphicCompose :: f (g a) -> Monomorphic (f :.: g)Source

withPolymorhic :: Monomorphicable k => MonomorphicRep k -> (forall a. k a -> b) -> bSource

Apply dependently-typed function to the monomorphic representation.

liftPoly :: Monomorphicable k => (forall a. k a -> b) -> MonomorphicRep k -> bSource

Flipped version of `withPolymorhic`

.

viaPoly :: (Monomorphicable k, Monomorphicable k') => (forall x y. k x -> k' y) -> MonomorphicRep k -> MonomorphicRep k'Source

Demote the function between polymorphic types into the one between monomorphic one.