Reputation: 3068
In Haskell, it's possible to add constraints to a type parameter.
For example:
foo :: Functor f => f a
The question: is it possible to negate a constraint?
I want to say that f
can be anything except Functor
for example.
UPD:
So it comes from the idea of how to map the bottom nested Functor.
Let's say I have Functor a
where a
can be a Functor b
or not and the same rules works for b
.
Upvotes: 3
Views: 394
Reputation: 120751
Reasons why this is not possible: (basically all the same reason, just different aspects of it)
Now, all that said, there is a way you can kind of fake this: with an overlapping instance. Don't do it, it's a bad idea, but... that's the closest you can get.
Upvotes: 7