gatoatigrado
gatoatigrado

Reputation: 16850

Partially applied type constructors in instance declarations

I have a type constructor

type SimpleFcn α m = m α -> m α

and I want to use it in a class where it will be further parameterized later. Namely,

instance A (SimpleFcn α)

In my situation, any functions in the class A would be parametric in argument m.

class A β where f :: Monad m => β m
instance A (SimpleFcn α) where f x = x

What is an appropriate workaround for this situation?

Upvotes: 3

Views: 557

Answers (1)

fuz
fuz

Reputation: 92976

It is not possible to partitially apply type synonyms, as they are just a way to shorten your code and not real type-level lambdas. You can try to use a newtype instead.

Upvotes: 3

Related Questions