Is there a Haskell extension (GHC) for instances of a partial type synonym?

Using the extension TypeSynonymInstances, you can write such an instance:

instances MyClass String where ...

Using newtype, you can declare such an instance:

newtype Kleisli m a b = Kleisli (a -> m b)

instance MyClass (Kleisli m) where ...

Now I can not do the following:

type Kleisli m a b = a -> m b

instance MyClass (Kleisli m) where ...

Now there is an extension that allows me to do this? If not, what problems prohibit such an extension?

+4
source share
1 answer

Haskell does not allow partially applicable type synonyms since the decision about equality between a type and partially applied type synonym is equivalent to deciding whether two functions are equal. This is generally impossible.

, - ( ).

. .

+8

Source: https://habr.com/ru/post/1533565/


All Articles