Making ByteString and Text instances of Foldable… almost

I just noticed you can do this:

And then use it like this:

Notice that those are the polymorphic Foldable functions maximum and mapM_, not Text-specific functions. I don’t know if this has any real-world applications, but it’s kind of neat…

Update: As pointed out by lfairy on Reddit, the FMList type works kind of like this.

Leave a Reply