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

Safe HaskellSafe-Inferred
LanguageHaskell98

Data.Type.Monomorphic

Synopsis

Documentation

data Monomorphic k Source

A wrapper type for polymophic types.

Constructors

forall a . Monomorphic (k a) 

Instances

class Monomorphicable k where Source

A types which have the monomorphic representation.

Associated Types

type MonomorphicRep k :: * Source

Monomorphic representation

Methods

promote :: MonomorphicRep k -> Monomorphic k Source

Promote the monomorphic value to the polymophic one.

demote :: Monomorphic k -> MonomorphicRep k Source

Demote the polymorphic value to the monomorphic representation.

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

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) -> b Source

Apply dependently-typed function to the monomorphic representation.

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

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

Constructors

Comp (f (g a))