Portability | portable |
---|---|
Stability | experimental |
Maintainer | Edward Kmett <ekmett@gmail.com> |
Safe Haskell | Trustworthy |
- data Proxy s = Proxy
- reproxy :: proxy s -> Proxy t
- asProxyTypeOf :: a -> proxy a -> a
Proxy values
reproxy :: proxy s -> Proxy tSource
Some times you need to change the proxy you have lying around.
Idiomatic usage is to make a new combinator for the relationship
between the proxies that you want to enforce, and define that
combinator using reproxy
.
data Succ n reproxySucc :: proxy n -> Proxy (Succ n) reproxySucc = reproxy
asProxyTypeOf :: a -> proxy a -> aSource
asProxyTypeOf
is a type-restricted version of const
.
It is usually used as an infix operator, and its typing forces its first
argument (which is usually overloaded) to have the same type as the tag
of the second.