[Haskell-cafe] Sets, typeclasses and functional dependencies

Bardur Arantsson spam at scientician.net
Sun Aug 1 21:07:13 UTC 2021


On 31/07/2021 11.14, Henning Thielemann wrote:
> 
> A more modern approach would use type functions:
> 
> class Setish set where
>   type Element set
>   empty :: set
>   singleton :: Element set -> set
> 

Just to add: This would be an "extensional" set, i.e one specified
explicitly by its elements. But there are also "intensional" sets which
are defined by some sort of mathematical property that holds for its
elements.

Naturally, the operations that make sense for either of those is *very*
different.




More information about the Haskell-Cafe mailing list