TypeFamily, , , , .
{-
{-
{-
{-
import GHC.Exts (Constraint)
import Data.Proxy
data Dict c where
Dict :: c => Dict c
Ctx a, . cdict C Ctx, Ctx, . .
class C a where
type Ctx a :: Constraint
cdict :: Proxy a -> CDict a
A cdict Dict, C a, Ctx a a
type CDict a = Dict (C a, Ctx a)
Int
instance C Int where
type Ctx Int = ()
cdict _ = Dict
C a, C b
instance (C a, C b) => C (a, b) where
type Ctx (a, b) = (C a, C b)
cdict _ = Dict
fstCDict .
fstCDict :: forall a b. CDict (a, b) -> CDict a
fstCDict Dict = case cdict (Proxy :: Proxy a) of Dict -> Dict
C, Show
instance (C a) => C (Maybe a) where
type Ctx (Maybe a) = (C a, Show a)
cdict _ = Dict
Could not deduce (Show a) arising from a use of `Dict'
from the context (C a)
bound by the instance declaration ...
Possible fix:
add (Show a) to the context of the instance declaration
In the expression: Dict
In an equation for `cdict': cdict _ = Dict
In the instance declaration for `C (Maybe a)'