This module provides a monadic interface for The Elm Architecture.
Basically IO is a monad enabing two kinds of effects :
Cmd commandsIOThis module port the four main way of running an Elm application to IO.
Program using IO.
Port of Platform.program with IO.
Port of VirtualDom.program with IO (also works with HTML).
Port of Platform.programWithFlags with IO.
Port of VirtualDom.programWithFlags with IO (also works with HTML).
IOReturns an IO whose only effect is containing the value given to pure.
Lift a Cmd as an IO
Lift a CmdM as an IO
An IO doing nothing (an containing no values!)
An IO that returns the current model
An IO that sets the model
A IO that modify the model
Map a function over an IO.
Laws
Chains IOs.
If you have an IO model a and a function which given
a a can give you an IO model b depending on the value
of type a given to the function. Then bind gives you
an IO model b that will run the first IO and then apply
the function.
Laws
Flatten an IO containing an IO into a simple IO.
Laws
Transform an IO containing functions into functions on IO
It enable to easily lift functions to IO.
Laws
You can think of traverse like a map but with effects.
It maps a function performing IO effects over a list.
Transform a list of IO into an IO of list.
Congruence by a Lens on an IO.
It would be silly to force users to redefine every IO
for each application model. Lenses enable to lift an IO
action on a model a to the same IO but action on a
model b.
You can then define your IO on the minimal model and
lift them to you real application's model when needed.
Congruence by a Select on an IO.
Just like lenses but with Select
Transform a program using IO into a normal program.
Transform a program using IO into a normal program.
Combine a list of IO. Its use is strongly discouraged!
Use mapM instead!
Combine two IO. Its use is strongly discouraged!
Use mapM instead!
Monadic interface for The Elm Architecture.
A value of type
IO m ais an effectful computation that can modify the modelm, perform commands and contains values of typea.