Safe Haskell | None |
---|
- class Applied t tab | t -> tab where
- class Unapplied ptab t | ptab -> t where
- unap :: Proxy (t a) -> (Proxy t, Proxy a)
- ap :: Proxy t -> Proxy a -> Proxy (t a)
- asApplied :: Applied ta tab => tab -> Proxy ta -> tab
- unappliedOf :: Unapplied (Proxy tab) t => tab -> Proxy t
- class IsOfBaseType t tab b | t tab -> b
- class AreEqUnapplied ta tb b | ta tb -> b
Documentation
NOTE: All classes here should be considered closed.
Manipulating Proxy types
class Applied t tab | t -> tab whereSource
A relation between a (maybe-partially-applied) type and that type fully applied.
class Unapplied ptab t | ptab -> t whereSource
A relation between a (maybe-partially-applied) type and that type stripped of all its arguments.
When the bare type is ambiguous (e.g. unapplied (p :: Proxy (m a))
), an
overlapping instances type error will be raised.
Composing and decomposing Proxy types
Using proxy types with real values
asApplied :: Applied ta tab => tab -> Proxy ta -> tabSource
Force the first argument to the fully applied
proxy type of the second, e.g.
>>>
let x = (Left 1) `asApplied` (Proxy :: Proxy (Either Double))
>>>
:t x
x :: Either Double a
unappliedOf :: Unapplied (Proxy tab) t => tab -> Proxy tSource
Create a proxy value for the completely unapplied
type of tab
Predicate classes
class IsOfBaseType t tab b | t tab -> bSource
A predicate class that returns True
when t
is a partially-applied
"prefix" type of tab
, i.e. tab
can be unap
-ed to t
.
~ Bool false False => IsOfBaseType k k1 t x false | |
IsOfBaseType k k t t True | |
IsOfBaseType k (k2 -> k1) t ta bool => IsOfBaseType k k1 t (ta b) bool | |
IsOfBaseType k k (t a) (t a) True |
class AreEqUnapplied ta tb b | ta tb -> bSource
A predicate class that returns True
when the unapplied base type of
ta
and tb
are identical.
(Unapplied k (Proxy k1 ta) t, IsOfBaseType k k2 t tb b) => AreEqUnapplied k1 k2 ta tb b |