{-# LANGUAGE CPP #-}
module Data.HList.Label6 () where
import Data.HList.FakePrelude
import GHC.TypeLits
import Data.HList.HListPrelude
#if MIN_VERSION_base(4,7,0)
instance KnownSymbol x => ShowLabel (x :: Symbol) where
showLabel :: Label x -> String
showLabel Label x
_ = forall (n :: Symbol) (proxy :: Symbol -> *).
KnownSymbol n =>
proxy n -> String
symbolVal (forall {k} (t :: k). Proxy t
Proxy :: Proxy x)
instance KnownNat x => ShowLabel (x :: Nat) where
showLabel :: Label x -> String
showLabel Label x
_ = forall a. Show a => a -> String
show forall a b. (a -> b) -> a -> b
$ forall (n :: Nat) (proxy :: Nat -> *).
KnownNat n =>
proxy n -> Integer
natVal (forall {k} (t :: k). Proxy t
Proxy :: Proxy x)
#else
instance SingI x => ShowLabel (x :: Symbol) where
showLabel _ = fromSing (sing :: Sing x)
instance SingI x => ShowLabel (x :: Nat) where
showLabel _ = show (fromSing (sing :: Sing x))
#endif
instance HExtend (Label (y :: Symbol)) (Proxy (x ': xs :: [Symbol])) where
type HExtendR (Label y) (Proxy (x ': xs)) = Proxy (y ': x ': xs)
.*. :: Label y -> Proxy (x : xs) -> HExtendR (Label y) (Proxy (x : xs))
(.*.) Label y
_ Proxy (x : xs)
_ = forall {k} (t :: k). Proxy t
Proxy
instance HExtend (Label (y :: Nat)) (Proxy (x ': xs :: [Nat])) where
type HExtendR (Label y) (Proxy (x ': xs)) = Proxy (y ': x ': xs)
.*. :: Label y -> Proxy (x : xs) -> HExtendR (Label y) (Proxy (x : xs))
(.*.) Label y
_ Proxy (x : xs)
_ = forall {k} (t :: k). Proxy t
Proxy