module Data.Proxy
  (
        Proxy(..), asProxyTypeOf
      , KProxy(..)
  ) where
import GHC.Base
import GHC.Show
import GHC.Read
import GHC.Enum
import GHC.Arr
data Proxy t = Proxy
data KProxy (t :: *) = KProxy
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
    unsafeIndex _ _   = 0
    unsafeRangeSize _ = 1
instance Bounded (Proxy s) where
    minBound = Proxy
    maxBound = Proxy
instance Monoid (Proxy s) where
    mempty = Proxy
    mappend _ _ = Proxy
    mconcat _ = Proxy
instance Functor Proxy where
    fmap _ _ = Proxy
    
instance Applicative Proxy where
    pure _ = Proxy
    
    _ <*> _ = Proxy
    
instance Monad Proxy where
    return _ = Proxy
    
    _ >>= _ = Proxy
    
asProxyTypeOf :: a -> Proxy a -> a
asProxyTypeOf = const