You could always do a Coyoneda transform.

data IntSetF a = IntSetF !IntSet (Int -> a)

The Functor and Foldable instances are pretty obvious from it. Similarly with your Enumerator idea.

On Wed, Sep 5, 2018, 05:56 Johannes Waldmann <johannes.waldmann@htwk-leipzig.de> wrote:
Hi David,

Thanks for responding.
Let me re-phrase the technical question: in some hypothetical

>       instance Foldable Enumerator where ...

the methods (e.g., foldMap) would be overconstrained.
Is there a way to still write something like it?

It seems not, as shown by these examples:

Data.EnumSet cannot implement Foldable because of  Enum k.
http://hackage.haskell.org/package/enummapset/docs/Data-EnumSet.html

Data.IntSet cannot implement Foldable because of   k ~ Int.

- J.
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.