Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell98 |
- 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 k) | |
(Show (MonomorphicRep k k1), Monomorphicable k k1) => Show (Monomorphic k k) |
class Monomorphicable k where Source
A types which have the monomorphic representation.
type MonomorphicRep k :: * Source
Monomorphic representation
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.
monomorphicCompose :: f (g a) -> Monomorphic (f :.: g) Source
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.