[Haskell-cafe] how to Enumerate without lists?
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.
> Data.IntSet cannot implement Foldable because of k ~ Int.
> - J.
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe