{-# LANGUAGE DataKinds #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# OPTIONS_GHC -Wno-unused-imports #-}
module Chapter02 where
import Control.Monad.Trans.Class (MonadTrans)
import GHC.TypeLits
-- >>>:kind! (1 + 17) - 3
-- (1 + 17) - 3 :: Natural
-- = 15
-- >>>:kind! (Div 128 8) ^ 2
-- (Div 128 8) ^ 2 :: Natural
-- = 256
-- >>>:kind! Show
-- Show :: * -> Constraint
-- = Show
-- >>>:kind! Functor
-- Functor :: (* -> *) -> Constraint
-- = Functor
-- >>>:kind! Monad
-- Monad :: (* -> *) -> Constraint
-- = Monad
-- >>>:kind! MonadTrans
-- MonadTrans :: ((* -> *) -> * -> *) -> Constraint
-- = MonadTrans
type family Not (x :: Bool) :: Bool where
Not 'True = 'False
Not 'False = 'True
type family Foo1 (x :: Bool) (y :: Bool) :: Bool
type family Bar1 x y :: Bool -> Bool -> Bool
-- >>>:kind Foo1
-- Foo1 :: Bool -> Bool -> Bool
-- >>>:kind Bar1
-- Bar1 :: * -> * -> Bool -> Bool -> Bool