miso

🍜 A tasty Haskell UI framework 🍜

React meets Haskell.

miso is a small, fast Haskell library for building web and native user interfaces. It pairs Elm's model–view–update with React-style Components, and compiles to WebAssembly or JavaScript.

Copied
$git clone https://github.com/haskell-miso/miso-sampler && cd miso-sampler
$nix develop .#wasm --command bash -c 'make all && make serve'

Web

Compile to WebAssembly or JavaScript. Virtual DOM, event delegation, hydration and server-side rendering out of the box.

Coming soon

Desktop

Lynxtron brings Lynx to the desktop, Electron-style. The same miso components will run there unchanged.

Your first miso application 🍜

A model, an update function and a view. That is a Component, and a whole application.

Main.hs
import Miso
  ( Component, Effect, View, component
  , vfrag, text, startApp, defaultEvents
  )
import Miso.Lens (this, (+=), (-=))
import Miso.String (ms)
import Miso.Html.Element (button_)
import Miso.Html.Event (onClick)

data Action = Add | Subtract

counter
  :: Component context props Int Action
counter = component m u v
  where
    m :: Int
    m = 0

    u :: Action
      -> Effect context props Int Action
    u = \case
      Add      -> this += 1
      Subtract -> this -= 1

    v :: context
      -> props
      -> Int
      -> View context Int Action
    v _ _ n = vfrag
      [ button_ [ onClick Subtract ] [ "−" ]
      , text (ms n)
      , button_ [ onClick Add ] [ "+" ]
      ]

main :: IO ()
main = startApp defaultEvents counter
Live
0

What's in the box

miso borrows the best ideas from React and Elm and gives them Haskell types.

Generative AI ready

Claude Fable generated this entire website. Every page, every interaction, 100% miso. Strong types, a pure view and a total update function give AI agents (and humans) tight feedback and maximum productivity: if it compiles, it usually works.

✦ Built by Claude Fable · 100% miso

Batteries included 🔋

Games, browser API demos, integrations and libraries, all written in miso.