I am currently in the process of cleaning up this library.
Funland’s version 0.8
will have many fixes and better documentation.
The main reason why I do not feel ready yet to release a 1.0
is that the FunLandic
namespace, which includes a set of common Algebraic Data Type implementations, is still part of the library.
I am not entirely sure what makes most sense for extracting the two. Probably FunLandic
will be moved to its own library, but this will make it harder to test FunLand
itself, and maybe also harder to understand for newcomers, as there are then no clear examples of structures implementing the behaviours inside FunLand itself.
What to do, what to do…
Another issue, which I have solved for now, but maybe there is a better way, is that certain functions like traverse
work wonderful in a statically-typed language where the function used in the implementation depends on the return type. But in Elixir, we do not have this information, so traverse
will take as extra argument the module of the return type you want to build (or a datatype indicating that module):
iex> FunLand.Traversable.traverse([1, 2, 3], FunLandic.Maybe, fn x -> FunLandic.Maybe.just(x) end)
FunLandic.Maybe.just([1, 2, 3])
iex> FunLand.Traversable.traverse([1, 2, 3], [], fn x -> [x,x] end)
[[1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3],
[1, 2, 3]]
I think this is as idiomatic as it is going to get…
Help is greatly appreciated .