#ifdef __GLASGOW_HASKELL__
#endif
module Data.Proxy
(
Proxy(..), asProxyTypeOf
#ifdef __GLASGOW_HASKELL__
, KProxy(..)
#endif
) where
import Data.Monoid
import GHC.Base
import GHC.Show
import GHC.Read
import GHC.Enum
import GHC.Arr
data Proxy t = Proxy
#ifdef __GLASGOW_HASKELL__
data KProxy (t :: *) = KProxy
#endif
instance Eq (Proxy s) where
_ == _ = True
instance Ord (Proxy s) where
compare _ _ = EQ
instance Show (Proxy s) where
showsPrec _ _ = showString "Proxy"
instance Read (Proxy s) where
readsPrec d = readParen (d > 10) (\r -> [(Proxy, s) | ("Proxy",s) <- lex r ])
instance Enum (Proxy s) where
succ _ = error "Proxy.succ"
pred _ = error "Proxy.pred"
fromEnum _ = 0
toEnum 0 = Proxy
toEnum _ = error "Proxy.toEnum: 0 expected"
enumFrom _ = [Proxy]
enumFromThen _ _ = [Proxy]
enumFromThenTo _ _ _ = [Proxy]
enumFromTo _ _ = [Proxy]
instance Ix (Proxy s) where
range _ = [Proxy]
index _ _ = 0
inRange _ _ = True
rangeSize _ = 1
#ifdef __GLASGOW_HASKELL__
unsafeIndex _ _ = 0
unsafeRangeSize _ = 1
#endif
instance Bounded (Proxy s) where
minBound = Proxy
maxBound = Proxy
instance Functor Proxy where
fmap _ _ = Proxy
instance Monoid (Proxy s) where
mempty = Proxy
mappend _ _ = Proxy
mconcat _ = Proxy
instance Monad Proxy where
return _ = Proxy
_ >>= _ = Proxy
asProxyTypeOf :: a -> Proxy a -> a
asProxyTypeOf = const