lue-bird/elm-emptiness-typed/1.0.0

NOTE: the latest version is 9.2.1

elm-emptiness-typed

Deal with emptiness in a way that doesn't make life hard.

ListIs

Handle Emptiable and NotEmpty lists at once.

import ListIs

ListIs.empty         -- ListIs Emptiable a_
    |> ListIs.appendNotEmpty
        (ListIs.fromCons 1 [ 2, 3 ])
                     -- ListIs notEmpty_ Int
    |> ListIs.cons 5 -- ListIs notEmpty_ Int
    |> ListIs.toTuple
--> ( 5, [ 1, 2, 3 ] )

HoleyFocusList

A list zipper that can also focus before and after every item.

import HoleyFocusList

HoleyFocusList.empty           -- HoleyFocusList HoleOrItem a_
    |> HoleyFocusList.plug 5   -- HoleyFocusList item_ Int
    |> HoleyFocusList.append [ 1, 2, 3 ]
                               -- HoleyFocusList item_ Int
    |> HoleyFocusList.nextHole -- HoleyFocusList HoleOrItem Int
    |> HoleyFocusList.toList
--> [ 5, 1, 2, 3 ]

→ zwilias's holey-zipper with a type-safe implementation using MaybeIs and other minor tweaks.

MaybeIs

Maybe + type information: does it exist?

This is the building block for all the data structures in this package.