Skip to content

Managing function declarations in typeclass instances (here Functor) #674

Answered by eliaslfox
ornamentist asked this question in Help!
Discussion options

You must be logged in to vote

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 an Eq :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.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@ornamentist
Comment options

@eliaslfox
Comment options

@ornamentist
Comment options

Answer selected by ornamentist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help!
Labels
None yet
2 participants