Im trying to understand the design of Haskell's Data.Collection
library, coming from a Scala-literate background.
It uses Functional Dependencies (which have a Scala analog) but the way they're used doesn't make sense to me. In the Unfoldable
class, reproduced below, the element type i
is shown as determined by the collection type c
.
class Unfoldable c i | c -> i
Class of collection with unobservable elements. It is the dual of the
Foldable
class.
Please explain the role that the dependency c -> i
is playing here and the design intent, ideally with an example of usage?