Closed lukaszcz closed 1 month ago
Haskell Set doesn't have a Functor instance.
The reason given is that the Functor law:
fmap (g . f) = fmap g . fmap f
can be violated. On the right duplicates are removed using f
and then g
. Whereas on the left duplicates are removed using g
only.
I'm not sure if this is an issue for our Set implementation.
Right, forgot about that. But we should have Set.map
at least.
I also have an implementation of isSubset
. This should be in stdlib and probably should be improved.
isSubset {A} {{Ord A}} (sub sup : Set A) : Bool := all (x in Set.toList sub) Set.isMember x sup;