https://github.com/jschomay/elm-bounded-number
A type representing bounded numbers in Elm.
https://github.com/jschomay/elm-bounded-number
Last synced: 7 months ago
JSON representation
A type representing bounded numbers in Elm.
- Host: GitHub
- URL: https://github.com/jschomay/elm-bounded-number
- Owner: jschomay
- License: bsd-3-clause
- Created: 2017-03-01T03:34:29.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-10-21T14:37:53.000Z (over 4 years ago)
- Last Synced: 2024-05-02T05:52:57.808Z (about 1 year ago)
- Language: Elm
- Homepage: http://package.elm-lang.org/packages/jschomay/elm-bounded-number/latest
- Size: 12.7 KB
- Stars: 9
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# elm-bounded-number
A type representing bounded numbers. Once a bound is set, the bounded value can never go out of this range.
between 1 10
|> set 7
|> inc 5
|> value
-- (equals 10)This is used in `elm-paginate`.
This is a very simple package with the express purpose of moving the logic of bounds-checking into a data structure to make your code more concise and clear. See more about "Adding behavior with types instead of logic in Elm" in this video demonstrating a novel use of this package: https://www.youtube.com/watch?v=DxCca6_wdwI.