We've done a bad thing.
Haskell
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.md
super.hs

README.md

superoption

"We've done a bad thing."

Functional programmers are familiar with Option types (or Maybes, in Haskell-speak). superoption extends the idea of an option type from just None and Some (in SML-speak) to None, Some, and Lots. This allows programmers more fine-grained control over their types that can hold any number of values (ours are called "superoption").

One possible application of this demonstrated here is sorting algorithms. Algorithms which have runtime O(n^2) can often be faster for small inputs than those of O(nlogn) or similar. The programmer can use superoption types to determine which algorithm to use.

We further include the notion of All in our superoptions, which is for holding infinite numbers of elements (in a stream).

Since this is already a bizarre and not particularly serious endeavor, we use GADTs to enforce various constraints.