1

In Haskell, the class Foldable is standalone i.e.

class Foldable t where ...

However, in Frege:

class Functor t => Foldable t where ...

Why was this constraint introduced? What ill-formed programs/ideas can it rule out?

It prevented me from defining an instance Foldable HashSet, where HashSet is a custom data type which wraps Data.HashMap to provide a set-based interface. (It can be worked around by applying toList first, so it's not a serious issue.)

Ohashi
  • 397
  • 3
  • 14

2 Answers2

3

I think this discussion give you the whole feedback on the topic (especially part about Sets) Haskell : An example of a Foldable which is not a Functor (or not Traversable)?

Pawel Szulc
  • 1,041
  • 2
  • 12
  • 19
2

I can only guess that it used to be the case that Haskell's Foldable did have Functor as a superclass once and that Frege inherited the Foldable code at this time. Could've been 2012 or so.

I'm not sure I understand your concern as Data.HashMap is indeed a Functor. But anyway, I invite you to design a patch and make a pull request.

Ingo
  • 36,037
  • 5
  • 53
  • 100