[Haskell-cafe] how to Enumerate without lists?

Zemyla zemyla at gmail.com
Wed Sep 5 15:04:16 UTC 2018


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 at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20180905/1df015c1/attachment.html>


More information about the Haskell-Cafe mailing list