Realm v0.1.0 API Reference
Modules
A set of functions to mimic the standard Haskell libraries feature a number of type classes with algebraic or category-theoretic underpinnings. The functions in this module come in two flavors: named or operators. For example
An extension of Realm.Functor
, Apply
provides a way to apply arguments
to functions when both are apply in the same kind of container. This can be
seen as running function application "in a context".
For a nice, illustrated introduction,
see Functors, Applicatives, And Monads In Pictures.
Arrows abstract the idea of computations, potentially with a context. Arrows are in fact an abstraction above monads, and can be used both to express all other type classes in Realm. They also enable some nice flow-based reasoning about computation. For a nice illustrated explination, see Haskell/Understanding arrows Arrows let you think diagrammatically, and is a powerful way of thinking about flow programming, concurrency, and more.
A category is some collection of objects and relationships (morphisms) between them.
This idea is captured by the notion of an identity function for objects,
and the ability to compose relationships between objects. In most cases,
these are very straightforward, and composition and identity are the standard
functions from the Quark
package or similar.
Functors are datatypes that allow the application of functions to their interior values. Always returns data in the same structure (same size, tree layout, and so on). Please note that bitstrings are not functors, as they fail the functor composition constraint. They change the structure of the underlying data, and thus composed lifting does not equal lifing a composed function. If you need to map over a bitstring, convert it to and from a charlist.
Monoid extends the semigroup with the concept of an "empty" or "zero" element.
Ord
describes how to order elements of a data type.
This is a total order, so all elements are either :equal
, :greater
, or :lesser
than each other.
A semigroup is a structure describing data that can be appendenated with others of its type. That is to say that appending another list returns a list, appending one map to another returns a map, and appending two integers returns an integer, and so on. These can be chained together an arbitrary number of times. For example
A semigroupoid describes some way of composing morphisms on between some collection of objects.
A setoid is a type with an equivalence relation.
This is most useful when equivalence of some data is not the same as equality.
Since some types have differing concepts of equality, this allows overriding
the behaviour from Kernel.==/2
. To get the Setoid ==
operator override,
simply use Realm.Setoid
.