{-# 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
Dict c a
_ == :: Dict c a -> Dict c a -> Bool
== Dict c a
_ = Bool
True
instance Show (Dict c a) where
showsPrec :: Int -> Dict c a -> ShowS
showsPrec Int
_ Dict c a
Dict = String -> ShowS
showString String
"Dict"
instance Show1 (Dict c) where
liftShowsPrec :: forall a.
(Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Dict c a -> ShowS
liftShowsPrec Int -> a -> ShowS
_ [a] -> ShowS
_ = Int -> Dict c a -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec
requiringDict :: (c a => r) -> (Dict c a -> r)
requiringDict :: forall {k} (c :: k -> Constraint) (a :: k) r.
(c a => r) -> Dict c a -> r
requiringDict c a => r
r = \Dict c a
Dict -> r
c a => r
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