{"id":16389473,"url":"https://github.com/qqwy/elixir-fun_land","last_synced_at":"2026-05-21T09:01:20.515Z","repository":{"id":9690002,"uuid":"62919899","full_name":"Qqwy/elixir-fun_land","owner":"Qqwy","description":"Algebraic Data Types for Elixir: Both functional and fun.","archived":false,"fork":false,"pushed_at":"2023-04-10T15:59:33.000Z","size":179,"stargazers_count":69,"open_issues_count":8,"forks_count":4,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-03-15T00:04:30.730Z","etag":null,"topics":["adt","algebraic-data-types","elixir","elixir-lang","fun-land","monad"],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Qqwy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-07-08T22:03:27.000Z","updated_at":"2023-03-04T14:24:02.000Z","dependencies_parsed_at":"2023-01-13T15:30:52.267Z","dependency_job_id":"d97a81f3-ab1e-46dd-8a56-f0168c7c5366","html_url":"https://github.com/Qqwy/elixir-fun_land","commit_stats":null,"previous_names":["qqwy/elixir_fun_land"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Qqwy%2Felixir-fun_land","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Qqwy%2Felixir-fun_land/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Qqwy%2Felixir-fun_land/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Qqwy%2Felixir-fun_land/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Qqwy","download_url":"https://codeload.github.com/Qqwy/elixir-fun_land/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243822283,"owners_count":20353499,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adt","algebraic-data-types","elixir","elixir-lang","fun-land","monad"],"created_at":"2024-10-11T04:33:11.720Z","updated_at":"2025-12-12T00:28:55.809Z","avatar_url":"https://github.com/Qqwy.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FunLand\n\n[![hex.pm version](https://img.shields.io/hexpm/v/fun_land.svg)](https://hex.pm/packages/fun_land)\n[![Build Status](https://travis-ci.org/Qqwy/elixir_fun_land.svg?branch=master)](https://travis-ci.org/Qqwy/elixir_fun_land)\n\nFunLand adds Behaviours to define [Algebraic Data Types](https://en.wikipedia.org/wiki/Algebraic_data_type) ('Container' data types) to Elixir, including many helpful operations with them. Where applicable, an ADT implementation for Elixir's built-in types like Lists, Maps, Strings and Functions are included.\n\nAlso included are some implementations of commonly-used ADTs, for your leisure. _(These might be split off in their own library in the future)_\n\nFunLand is based on ideas of the [Fantasy Land](https://github.com/fantasyland/fantasy-land) JavaScript specification for Algebraic Data Types, as well as the implementations of ADTs in other languages, such as [Haskell](haskell.org) and [Idris](http://idris-lang.org/). \n\nFunLand attempts to use understandable names for the different behaviours and functions, to make ADTs as approachable to newcomers as possible.\n\n### Pre-release version\n\nAs can be seen below in the roadmap, FunLand is not fully finished yet. New pre-release versions might introduce backwards-incompatible changes.\n\nMostly lacking are:\n\n- Enough documentation.\n- Tests for most of the example implementations in `FunLand.Builtin.*`.\n\n### Changelog\n\n- 0.10.0 \n  - Fixes badly named module `Reducable` -\u003e `Reducible`. Thank you, Eksperimental!\n  - Makes `Reducible.to_list/1` overridable so you can add your own implementation for it if you desire.\n- 0.9.3 - Fixes bug that made it impossible to compile on Elixir 1.8.x\n- 0.9.2 - Numbers v5.0.0 support\n- 0.9.1 - Fixes dispatching of Builtin Structs to proper behaviour implementation modules. Adds Combinable and Reducable implementations for MapSet.\n- 0.9.0 - Split off FunLandic to its own library.\n- 0.8.0 - Important (backwards-incompatible) naming and functionality changes. Implementation of Traversable. Implementations for the SuccessTuple type.\n\n### Roadmap\n\n- [x] The most commong Algebraic Data Types, built as Behaviours that can be added to your own modules/structs:\n  - [x] *Mappable* - any structure you can `map` over: changing the contents without changing the structure.\n  - [x] *Appliable* - any Mappable structure you can combine two of, where the first contains a function to `apply_with` the contents of the second, returning a new strucure.\n  - [x] *Applicative* - any Appliable structure that can be created from any value you want to `wrap` inside.\n  - [x] *Chainable* - any Appliable structure that you can `bind` functions to, which, when given the contents of the structure, return a new version of the structure.\n  - [x] *Monad* - Anything structure that is both Applicative and Chainable, which makes them super flexible!\n    - [x] Monadic do-notation. (The implementation is heavily based on code from the [monad](https://github.com/rmies/monad) library. Lots of thanks!)\n      - [x] _let_ statements inside the monadic do-notation.\n  - [x] *Semicombinable* - Anything which, when you have two of them, you can `combine` them together into one.\n  - [x] *Combinable* - Anything that is Combinable, and also has a `neutral` value which you can combine something with when you don't have anything else, to keep the result the same.\n  - [x] *CombinableMonad* - Any structure that is both a Monad and Combinable.\n  - [x] *Reducible* - Any structure that can be `reduce`d to a single value, when given a Combinable (or alternatively, a starting value and a function to combine this with a single value inside the structure).\n  - [x] Traversable\n    - [x] Find out how to implement Traversable.traverse properly in a dynamically typed language. (How do you know what empty structure to return when being passed an empty structure?) -\u003e Pass explicit extra parameter with result module.\n- [x] Also, where to put these practical implementations? -\u003e FunLandic.*\n- [x] How to write proper code for the built-in types like List? (What to put in the monadic syntax? etc.)\n- [ ] Catcheable exceptions instead of raised strings.\n- [x] Implement some practical Algebraic Data Types to show what can be done with them:\n   - [x] List - the list we all know and love.\n   - [x] Maybe - either just filled with something, or empty (nothing inside)\n   - [x] Reader - store a state in a reader monad and refer to it only when you need it later on.\n   - [x] Writer - Keep a log of the things that happened alongside your computations.\n    - [x] A Custom Behaviour you can expand upon yourself, with your own log-appending mechanism.\n    - [x] IOListWriter, which logs using an IOList (an implementation of the writer behaviour that is useful in most common circumstances).\n   - [x] Sum - Combine any Mappable filled with numbers by summing them.\n   - [x] Product - Combine any Mappable filled with numbers by multiplying them.\n   - [x] Any - Combine any Mappable filled with booleans by checking if some property is true for at least one of them.\n   - [x] All - Combine any Mappable filled with booleans by checking if some property is true for all of them.\n   - [x] Either/Result - Contains two results, returns the first result of the two that is not empty.\n   - [x] SuccessTuple implementation of Either/Maybe! Wow!\n   - [ ] Fully write this readme.\n- [ ] Extend documentation.\n  - [ ] More Fruit Salad explanations.\n- [ ] Write as many tests as possible.\n- [ ] Revisit+extend code examples.\n\n### Later Future:\n\n- [ ] Comonad\n- [ ] Improve documentation, better fruit salad descriptions?\n\n\n## Installation\n\nThe package is available on [hex](https://hex.pm/packages/fun_land) and can can be specified as a dependency by adding the snippet below in your `mix.exs`.\n\n```elixir\ndef deps do\n  [{:fun_land, \"~\u003e 0.9.2\"}]\nend\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqqwy%2Felixir-fun_land","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqqwy%2Felixir-fun_land","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqqwy%2Felixir-fun_land/lists"}