tagged-0.2.3.1: Provides newtype wrappers for phantom types to avoid unsafely passing dummy argumentsSource codeContentsIndex
Data.Proxy
Portabilitygeneralized newtype deriving
Stabilityexperimental
MaintainerEdward Kmett <ekmett@gmail.com>
Contents
Tagged values
Conversion
Description
Synopsis
data Proxy p = Proxy
reproxy :: Proxy s -> Proxy t
asProxyTypeOf :: a -> Proxy a -> a
proxy :: Tagged s a -> Proxy s -> a
unproxy :: (Proxy s -> a) -> Tagged s a
Tagged values
data Proxy p Source
Constructors
Proxy
show/hide Instances
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.
Conversion
proxy :: Tagged s a -> Proxy s -> aSource
Convert from a Tagged representation to a representation based on a Proxy.
unproxy :: (Proxy s -> a) -> Tagged s aSource
Convert from a representation based on a Proxy to a Tagged representation.
Produced by Haddock version 2.6.1