Ich versuche herauszufinden, ob es möglich ist (und wie) Klasseninstanzen für Multi-Parameter-Typ Synonyme zu definieren.Multi-Parameter Typ Synonym Instanzen
Zum Beispiel:
{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances #-}
type F a b = a -> b
data DF a b = DF (a -> b)
class C c a b where
doc :: c a b -> a -> b
Es funktioniert für eine Multi-param Typ-Instanz:
instance C DF a b where
doc (DF f) x = f x
Aber es funktioniert nicht für Synonyme Typ:
-- ERROR:
--
-- Type synonym `F' should have 2 arguments, but has been given none
-- In the instance declaration for `C F a b'
--
instance C F a b where
doc f x = f x
Ist es möglich, eine Typklasseninstanz für F
zu definieren?