Managing function declarations in typeclass instances (here Functor) #674
-
I'm probably missing something obvious here, but, I have a simple Set type:
And I'd like to implement
Coalton wants a constraint of |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
A couple things: Unfortunately there isn't a way to add a constraint where you want it. The I don't think sets have a valid functor instance. Map should obey |
Beta Was this translation helpful? Give feedback.
A couple things:
Unfortunately there isn't a way to add a constraint where you want it.
The
empty-set
function probably doesn't need anEq :a
constraint.I don't think sets have a valid functor instance. Map should obey
(map (compose f g)) == (compose (map f) (map g))
. Set's will remove elements if they compare equal. See Functor for more details.