-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Library to convert polymorphic datatypes to/from its monomorphic represetation -- -- This library provides the type-class and functions to convert between -- polymorphic data-types and its monomorphic representation type, such -- as length-indexed vectors, singletons for type-level natural numbers, -- etc. @package monomorphic @version 0.0.1.2 module Data.Type.Monomorphic type (:.:) f g = Compose f g -- | A wrapper type for polymophic types. data Monomorphic k Monomorphic :: (k a) -> Monomorphic k -- | A types which have the monomorphic representation. class Monomorphicable k where type family MonomorphicRep k :: * promote :: Monomorphicable k => MonomorphicRep k -> Monomorphic k demote :: Monomorphicable k => Monomorphic k -> MonomorphicRep k -- | Convinience function to demote polymorphic types into monomorphic one -- directly. demote' :: Monomorphicable k => k a -> MonomorphicRep k -- | Demote polymorphic nested types directly into monomorphic -- representation. demoteComposed :: Monomorphicable (f :.: g) => f (g a) -> MonomorphicRep (f :.: g) monomorphicCompose :: f (g a) -> Monomorphic (f :.: g) -- | Apply dependently-typed function to the monomorphic representation. withPolymorhic :: Monomorphicable k => MonomorphicRep k -> (forall a. k a -> b) -> b -- | Flipped version of withPolymorhic. liftPoly :: Monomorphicable k => (forall a. k a -> b) -> MonomorphicRep k -> b -- | Demote the function between polymorphic types into the one between -- monomorphic one. viaPoly :: (Monomorphicable k, Monomorphicable k') => (forall x y. k x -> k' y) -> MonomorphicRep k -> MonomorphicRep k' -- | Right-to-left composition of functors. The composition of applicative -- functors is always applicative, but the composition of monads is not -- always a monad. newtype Compose (f :: * -> *) (g :: * -> *) a :: (* -> *) -> (* -> *) -> * -> * Compose :: f (g a) -> Compose a getCompose :: Compose a -> f (g a) instance (Read (MonomorphicRep k k1), Monomorphicable k k1) => Read (Monomorphic k k1) instance (Show (MonomorphicRep k k1), Monomorphicable k k1) => Show (Monomorphic k k1)