Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redoing the standard classes [closed]

As evidenced by the Typeclassopedia, the current stack of classes imported from category theory is a bit of a tangled accident of history, rather than a beautiful coherent whole.

In particular, this makes it rather difficult to follow what's happening.

What should this stuff look like, if petty concerns like backwards compatibility, code duplication or tractably short type signatures were not an issue?

like image 271
MathematicalOrchid Avatar asked May 08 '12 14:05

MathematicalOrchid


2 Answers

For some subsets of the standard classes there have been attempts to give revised hierarchies.

Numeric Typeclasses

  • The Numeric Prelude. An experimental alternative hierarchy of numeric type classes

In particular, it provides a much richer set of mathematical abstractions.

Besides this, there are many other alternate designs:

  • Yet Another Prelude - a notable alternate prelude from Ross Paterson:

enter image description here

  • prelude-extras - higher order prelude functions
  • classy-prelude - a prelude with more classes

Categoric Typeclasses

There's been less work on the category-inspired classes, such as Functor, Monad, Monoid, Applicative and of course, Category.

The most important work is the

  • category-extras package, which provides a very rich library indeed, including the famous zygohistoprepromorphism.

enter image description here

like image 95
Don Stewart Avatar answered Nov 17 '22 17:11

Don Stewart


Regarding the "categorical" classes, there is also The Other Prelude. The class hierarchy outlined there has been implemented in Frege.

like image 10
Ingo Avatar answered Nov 17 '22 16:11

Ingo