Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/siriusstarr/elm-splat
Provides functions for unpacking lists items as arguments.
https://github.com/siriusstarr/elm-splat
Last synced: 23 days ago
JSON representation
Provides functions for unpacking lists items as arguments.
- Host: GitHub
- URL: https://github.com/siriusstarr/elm-splat
- Owner: SiriusStarr
- License: gpl-3.0
- Created: 2019-05-25T02:35:54.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-07-11T19:52:22.000Z (over 3 years ago)
- Last Synced: 2023-08-08T20:40:12.947Z (over 1 year ago)
- Language: Elm
- Size: 27.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Splat
## Introduction
This package provides functions analogous to the "splat" operator in other
languages, unpacking list elements into function arguments. All arguments must
be of the same type, given that lists cannot contain disparate types.## Functions
### splat2 : (a -> a -> b) -> List a -> Maybe b
Unpack the first 2 elements of a list as function arguments. Returns the
result as `Maybe`, with `Nothing` if the list is shorter than 2 elements or
`Just result` if the list could be unpacked successfully. If the function
takes more than 2 arguments, the result will be a partially applied form of the
function wrapped in `Just`.Example:
```
splat2 String.append [ "butter", "fly" ] == Just "butterfly"
```### splat3 : (a -> a -> a -> b) -> List a -> Maybe b
Unpack the first 3 elements of a list as function arguments. Returns the
result as `Maybe`, with `Nothing` if the list is shorter than 3 elements or
`Just result` if the list could be unpacked successfully. If the function
takes more than 3 arguments, the result will be a partially applied form of the
function wrapped in `Just`.Example:
```
splat3 String.replace [ ",", "/", "a,b,c,d,e" ] == Just "a/b/c/d/e"
```### splat4 : (a -> a -> a -> a -> b) -> List a -> Maybe b
Unpack the first 4 elements of a list as function arguments. Returns the
result as `Maybe`, with `Nothing` if the list is shorter than 4 elements or
`Just result` if the list could be unpacked successfully. If the function
takes more than 4 arguments, the result will be a partially applied form of the
function wrapped in `Just`.### splat5 : (a -> a -> a -> a -> a -> b) -> List a -> Maybe b
Unpack the first 5 elements of a list as function arguments. Returns the
result as `Maybe`, with `Nothing` if the list is shorter than 5 elements or
`Just result` if the list could be unpacked successfully. If the function
takes more than 5 arguments, the result will be a partially applied form of the
function wrapped in `Just`.### splat6 : (a -> a -> a -> a -> a -> a -> b) -> List a -> Maybe b
Unpack the first 6 elements of a list as function arguments. Returns the
result as `Maybe`, with `Nothing` if the list is shorter than 6 elements or
`Just result` if the list could be unpacked successfully. If the function
takes more than 6 arguments, the result will be a partially applied form of the
function wrapped in `Just`.### splat7 : (a -> a -> a -> a -> a -> a -> a -> b) -> List a -> Maybe b
Unpack the first 7 elements of a list as function arguments. Returns the
result as `Maybe`, with `Nothing` if the list is shorter than 7 elements or
`Just result` if the list could be unpacked successfully. If the function
takes more than 7 arguments, the result will be a partially applied form of the
function wrapped in `Just`.### splat8 : (a -> a -> a -> a -> a -> a -> a -> a -> b) -> List a -> Maybe b
Unpack the first 8 elements of a list as function arguments. Returns the
result as `Maybe`, with `Nothing` if the list is shorter than 8 elements or
`Just result` if the list could be unpacked successfully. If the function
takes more than 8 arguments, the result will be a partially applied form of the
function wrapped in `Just`.### splat9 : (a -> a -> a -> a -> a -> a -> a -> a -> a -> b) -> List a -> Maybe b
Unpack the first 9 elements of a list as function arguments. Returns the
result as `Maybe`, with `Nothing` if the list is shorter than 9 elements or
`Just result` if the list could be unpacked successfully. If the function
takes more than 9 arguments, the result will be a partially applied form of the
function wrapped in `Just`.