{-# LANGUAGE GADTs #-} data Calc a where CInt :: Int -> Calc Int CBool :: Bool -> Calc Bool Eq :: (Eq a) => Calc a -> Calc a -> Calc Bool -- ^^^^^^^^^ Why do I need the context? eval :: Calc a -> a eval (CInt i) = i eval (CBool b) = b eval (Eq a b) = eval a == eval b