Skip to content

Latest commit

 

History

History
33 lines (23 loc) · 562 Bytes

README.md

File metadata and controls

33 lines (23 loc) · 562 Bytes

A first-in, first-out queue (FIFO) backed by lists.

elm install avh4/elm-fifo

Basic API

empty : Fifo a

insert : a -> Fifo a -> Fifo a

remove : Fifo a -> (Maybe a, Fifo a)

Example

import Fifo

main =
    Fifo.empty
    |> Fifo.insert 7
    |> Fifo.insert 42
    |> Fifo.remove |> Tuple.second -- gets the updated queue
    |> Fifo.remove |> Tuple.first -- gets the value at the top
    |> Debug.toString
    |> Html.text
        -- Shows "Just 42"