Elmish implements core abstractions that can be used to build applications following “model view update” style of architecture, as made famous by Elm. The library however does not model any "view" and is intended for use in conjuction with a DOM/renderer, like React/ReactNative or VirtualDOM. For those familiar with Redux, the Fable applications targeting React or ReactNative may find Elmish a more natural fit than Redux allowing one to stay completely in idiomatic F#.
Elmish abstractions have been carefully designed to resemble Elm's "look and feel" and anyone familiar with post-Signal Elm terminology will find themselves at right home.
npm install --save fable-core fable-powerpack fable-elmish
Add a reference to the assemblies in the package folders (e.g.
Note that by itself the following program expects the
viewto carry out both DOM construction and DOM rendering.
open ElmishProgram.mkProgram init update view|> Program.run
Async: schedule a command transforming the results of an
open ElmishCmd.ofAsync asyncFunction arg ofSuccess ofError
Promise: schedule a command transforming the results of a
open ElmishCmd.ofPromise promiseFunction arg ofSuccess ofError
Result: Ok/Error type and operators.
This type is standard in F# 4.1 and will be removed from this lib when MS releases it.
UrlParser: Combinator for parsing browser's location url
Navigation: Integrate with browser's location and history
open Elmish.Browser.NavigationProgram.mkProgram init update view|> Program.toNavigable parser urlUpdate|> Program.run