edkelly303/elm-nested-tuples

Work with nested tuples more easily


License
BSD-3-Clause
Install
elm-package install edkelly303/elm-nested-tuples 1.0.2

Documentation

Elm Nested Tuples

Work with nested tuples of the form ( a, ( b, ( c, () ) ) ).

For example:

import NestedTuple exposing (cons, empty, define, mapper, endMapper, folder, endFolder)

myTuple = 
    cons 1 (cons "hello" empty)

myTuple

--> ( 1, ( "hello", () ) )

myMapper = 
    define
        |> mapper (\int -> int * 2)
        |> mapper (\str -> str ++ " world")
        |> endMapper

myMapper myTuple

--> ( 2, ( "hello world", () ) )

myFolder =     
    define
        |> folder (\int acc -> int * 2 + acc)
        |> folder (\str acc -> String.length str + acc)
        |> endFolder

myFolder 0 myTuple

--> 7