garados007 / triple / Triple

The elm core library is missing some functions that are usefull and I use often for my projects.

This library contains many functions to work with Triple types that are similar to the Tuple but contains three different values.

Creation


type alias Triple a b c =
( a, b, c )

a type alias for the triple (a, b, c) for convenience

triple : a -> b -> c -> Triple a b c

creates a new triple

Access

first : Triple a b c -> a

Access the first entry of the triple type

second : Triple a b c -> b

Access the second entry of the triple type

third : Triple a b c -> c

Access the third entry of the triple type

Insertion

insertFirst : a -> ( b, c ) -> Triple a b c

Add a component before the tuple to create a triple

insertSecond : b -> ( a, c ) -> Triple a b c

Insert a component inside a tuple to create a triple

insertThird : c -> ( a, b ) -> Triple a b c

Add a component after the tuple to create a triple

Removing

dropFirst : Triple a b c -> ( b, c )

Drop the first component of the triple to create a tuple

dropSecond : Triple a b c -> ( a, c )

Drop the second component of the triple to create a tuple

dropThird : Triple a b c -> ( a, b )

Drop the third component of the triple to create a tuple

Mapping

mapFirst : (a1 -> a2) -> Triple a1 b c -> Triple a2 b c

Map the first component of the triple

mapSecond : (b1 -> b2) -> Triple a b1 c -> Triple a b2 c

Map the second component of the triple

mapThird : (c1 -> c2) -> Triple a b c1 -> Triple a b c2

Map the third component of the triple

mapAll : (a1 -> a2) -> (b1 -> b2) -> (c1 -> c2) -> Triple a1 b1 c1 -> Triple a2 b2 c2

Map all components of the triple