https://github.com/vviktorpl/elm-incremental-list
https://github.com/vviktorpl/elm-incremental-list
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/vviktorpl/elm-incremental-list
- Owner: vViktorPL
- License: mit
- Created: 2019-06-05T19:13:41.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-06-05T20:45:57.000Z (almost 6 years ago)
- Last Synced: 2025-01-11T14:25:45.870Z (4 months ago)
- Language: Elm
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# elm-incremental-list
This library makes it easy to generate lists similarly to `List.range`
except you can provide custom increment/decrement functions.## Why?
Suppose you have the following Date API:
type alias Date =
{ year : Int
, month : Int
, day : Int
}nextDay : Date -> Date
prevDay : Date -> Dateand you would like to generate range of dates from 2019-01-01 to 2019-01-07.
`IncrementalList.range` function can be used in a following way:dateRange =
IncrementalList.range prevDay nextDaystartingDate =
{ year = 2019
, month = 1
, day = 1
}dates = dateRange startingDate 5
And if you want range between 2019-12-25 and 2019-01-01 you can use the following:
dates = dateRange startingDate -7
So, to sum up, this function makes it easy to create range generator of some
custom data type by providing increase/decrease functions.See more code examples in `IncrementalList.range` function docs.