Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/davidboers/elmeither
Implements the Either declaration in Elm.
https://github.com/davidboers/elmeither
either elm functional-programming package
Last synced: about 5 hours ago
JSON representation
Implements the Either declaration in Elm.
- Host: GitHub
- URL: https://github.com/davidboers/elmeither
- Owner: davidboers
- License: bsd-3-clause
- Created: 2021-05-06T20:55:29.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-05-07T19:06:27.000Z (over 3 years ago)
- Last Synced: 2023-08-08T20:39:29.992Z (over 1 year ago)
- Topics: either, elm, functional-programming, package
- Language: Elm
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Either Elm
The first time I tried Functional Programming, I thought "What the hell is this? Why would anybody program this way?" Then, I tried it out a little more. Then I realized how fun it is. Particularly the genius that comes with having to be resourceful. In no instance is that clearer than Haskell's `Maybe` and `Either` declarations.
```Haskell
-- Basically a nullable value. It could exist (as any type) or it could be Nothing.
-- Akin to Java's '@nullable' annotationtype Maybe a
= Just a
| Nothing-- Could be of type a or type b.
type Either a b
= Left a
| Right b
```Although `Maybe` is implemented in Elm, `Either` is not; until now. This module contains a declaration of Haskell's `Either` type, verbatim from the source code of the GHC library. It also contains a couple of other functions related to the declaration.
Just do
```
elm install kingwither/elmeither
```and the package will be installed!
```Elm
import Either exposing (Either(..))
```You're all set! `Either` is now `Either Haskell Elm`!