-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Haskell 98 phantom types to avoid unsafely passing dummy arguments
--   
--   Haskell 98 phantom types to avoid unsafely passing dummy arguments
@package tagged
@version 0.4.2.1


module Data.Tagged

-- | A <tt><a>Tagged</a> s b</tt> value is a value <tt>b</tt> with an
--   attached phantom type <tt>s</tt>. This can be used in place of the
--   more traditional but less safe idiom of passing in an undefined value
--   with the type, because unlike an <tt>(s -&gt; b)</tt>, a
--   <tt><a>Tagged</a> s b</tt> can't try to use the argument <tt>s</tt> as
--   a real value.
--   
--   Moreover, you don't have to rely on the compiler to inline away the
--   extra argument, because the newtype is "free"
newtype Tagged s b
Tagged :: b -> Tagged s b
unTagged :: Tagged s b -> b

-- | Some times you need to change the tag you have lying around. Idiomatic
--   usage is to make a new combinator for the relationship between the
--   tags that you want to enforce, and define that combinator using
--   <a>retag</a>.
--   
--   <pre>
--   data Succ n
--   retagSucc :: Tagged n a -&gt; Tagged (Succ n) a
--   retagSucc = retag
--   </pre>
retag :: Tagged s b -> Tagged t b

-- | Alias for <a>unTagged</a>
untag :: Tagged s b -> b

-- | Tag a value with its own type.
tagSelf :: a -> Tagged a a

-- | <a>untagSelf</a> is a type-restricted version of <a>untag</a>.
untagSelf :: Tagged a a -> a

-- | <a>asTaggedTypeOf</a> is a type-restricted version of <a>const</a>. 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.
asTaggedTypeOf :: s -> Tagged s b -> s
instance Typeable2 Tagged
instance Eq b => Eq (Tagged s b)
instance Ord b => Ord (Tagged s b)
instance Ix b => Ix (Tagged s b)
instance Bounded b => Bounded (Tagged s b)
instance (Data s, Data b) => Data (Tagged s b)
instance RealFloat a => RealFloat (Tagged s a)
instance RealFrac a => RealFrac (Tagged s a)
instance Floating a => Floating (Tagged s a)
instance Fractional a => Fractional (Tagged s a)
instance Integral a => Integral (Tagged s a)
instance Real a => Real (Tagged s a)
instance Num a => Num (Tagged s a)
instance Enum a => Enum (Tagged s a)
instance Traversable (Tagged s)
instance Foldable (Tagged s)
instance Monad (Tagged s)
instance Applicative (Tagged s)
instance Functor (Tagged s)
instance Monoid a => Monoid (Tagged s a)
instance Read b => Read (Tagged s b)
instance Show b => Show (Tagged s b)


module Data.Proxy
data Proxy p
Proxy :: Proxy p

-- | 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 <a>reproxy</a>.
--   
--   <pre>
--   data Succ n
--   reproxySucc :: Proxy n -&gt; Proxy (Succ n)
--   reproxySucc = reproxy
--   </pre>
reproxy :: Proxy s -> Proxy t

-- | <a>asProxyTypeOf</a> is a type-restricted version of <a>const</a>. 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.
asProxyTypeOf :: a -> Proxy a -> a

-- | Convert from a <a>Tagged</a> representation to a representation based
--   on a <a>Proxy</a>.
proxy :: Tagged s a -> Proxy s -> a

-- | Convert from a representation based on a <a>Proxy</a> to a
--   <a>Tagged</a> representation.
unproxy :: (Proxy s -> a) -> Tagged s a
instance Typeable1 Proxy
instance Eq (Proxy p)
instance Ord (Proxy p)
instance Show (Proxy p)
instance Read (Proxy p)
instance Data p => Data (Proxy p)
instance Traversable Proxy
instance Foldable Proxy
instance Monad Proxy
instance Monoid (Proxy s)
instance Applicative Proxy
instance Functor Proxy
instance Bounded (Proxy s)
instance Ix (Proxy s)
instance Enum (Proxy s)
