Haskell Language Common GHC Language Extensions MultiParamTypeClasses


It's a very common extension that allows type classes with multiple type parameters. You can think of MPTC as a relation between types.

{-# LANGUAGE MultiParamTypeClasses #-}

class Convertable a b where
    convert :: a -> b

instance Convertable Int Float where
    convert i = fromIntegral i

The order of parameters matters.

MPTCs can sometimes be replaced with type families.