fun_land v0.5.0 API Reference
Modules
FunLand defines many different Algebraic Data Types
Delegation module to be invoked when one of the FunLand behaviour-specifications is called with an Atom as argument
Delegation module to be invoked when one of the FunLand behaviour-specifications is called with a Float as argument
Delegation module to be invoked when one of the FunLand behaviour-specifications is called with an Integer as argument
Maps are Mappable, because we can map over {k, v}
-tuples to create new values
Delegation module to be invoked when one of the FunLand behaviour-specifications is called with a PID as argument
Delegation module to be invoked when one of the FunLand behaviour-specifications is called with a Port as argument
Delegation module to be invoked when one of the FunLand behaviour-specifications is called with a Reference as argument
Defines a ‘chain’ operation to apply a function that takes a simple value and outputs a new Chainable to a value inside a Chainable
If an operation is can combine two elements, and there is a clearly defined neutral
that can be used to keep the same element when used on an element
Things that are both combinable and a monad
FunLand Helper functions for some common Algorithmic Data Type implementations
Something is Mappable if there is a way to map a function over it
A Monad is something that is a Monad
Anything that implements the Reducable behaviour, can be reduced to a single value, when given a combinable (or combining-function + base value)
An operation is Semiombinable if you can combine two values using it,
but there is no clearly defined neutral
thing which you can combine with an element to obtain itself
TODO: Find out how to use this in a dynamically typed language
Under FunLandic, you can find many practical implementations of different Algebraic Data Types
This Combinable can be used to combine a Reducable of boolean values, returning true
if all of them are true
This Combinable can be used to combine a Reducable of boolean values, returning true
if any of them (e.g. at least one of them) is true
The Identity ADT is a wrapper around a single element
Product
wraps numbers. Each Product
struct is a wrapper around a single number, and basically says:
‘I want to treat this number as something that, when combined with another number, should be multiplied, using 1
as neutral element’
The Reader monad wraps a function that returns the contained value when asked. This is nice, as you can call things inside the Reader context, and only refer to the things inside the Reader when you require them. It thus enables lighter parameter-passing
Sum
wraps numbers. Each Sum
struct is a wrapper around a single number, and basically says:
‘I want to treat this number as something that, when combined with another number, should be summed, using 0
as neutral element’