{-# LANGUAGE GADTs #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE UndecidableSuperClasses #-}
module Barbies.Internal.Dicts
( Dict(..)
, requiringDict
, ClassF
, ClassFG
)
where
import Data.Functor.Classes (Show1(..))
data Dict c a where
Dict :: c a => Dict c a
instance Eq (Dict c a) where
_ == _ = True
instance Show (Dict c a) where
showsPrec _ Dict = showString "Dict"
instance Show1 (Dict c) where
liftShowsPrec _ _ = showsPrec
requiringDict :: (c a => r) -> (Dict c a -> r)
requiringDict r = \Dict -> r
class c (f a) => ClassF c f a where
instance c (f a) => ClassF c f a
class c (f a) (g a) => ClassFG c f g a where
instance c (f a) (g a) => ClassFG c f g a