{-# 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
_ = Proxy x -> String
forall (n :: Symbol) (proxy :: Symbol -> *).
KnownSymbol n =>
proxy n -> String
symbolVal (Proxy x
forall k (t :: k). Proxy t
Proxy :: Proxy x)
instance KnownNat x => ShowLabel (x :: Nat) where
showLabel :: Label x -> String
showLabel Label x
_ = Integer -> String
forall a. Show a => a -> String
show (Integer -> String) -> Integer -> String
forall a b. (a -> b) -> a -> b
$ Proxy x -> Integer
forall (n :: Nat) (proxy :: Nat -> *).
KnownNat n =>
proxy n -> Integer
natVal (Proxy x
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)
_ = HExtendR (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)
_ = HExtendR (Label y) (Proxy (x : xs))
forall k (t :: k). Proxy t
Proxy