monomorphic- Library to convert polymorphic datatypes to/from its monomorphic represetation

Safe HaskellSafe-Inferred




data Monomorphic k Source

A wrapper type for polymophic types.


forall a . Monomorphic (k a) 


class Monomorphicable k whereSource

A types which have the monomorphic representation.

Associated Types

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.

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.

newtype (f :.: g) a Source


Comp (f (g a))