Skip to content
/ elm-fifo Public

first in, first out (FIFO) queue

License

Notifications You must be signed in to change notification settings

avh4/elm-fifo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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"

About

first in, first out (FIFO) queue

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages