lue-bird/elm-linear-direction/4.1.0

NOTE: the latest version is 11.2.0

Linear

Up or Down a structure.

= Up
| Down

Either Up or Down.

alter

index

at :
location
-> structure
-> { structure : structure
, location : location
}

Save a location alongside a structure.

import Array
import Array.Linear


Array.fromList [ 'a', 'c', 'd' ]
    |> Linear.at ( Down, 2 )
    |> Array.Linear.insert (\() -> 'b')
--> Array.fromList [ 'a', 'b', 'c', 'd' ]
= ExpectedIndexForLength Int

Locating an index can fail for

  • negative numbers
  • numbers >= the structure's length