Web
Compile to WebAssembly or JavaScript. Virtual DOM, event delegation, hydration and server-side rendering out of the box.
โ๐ A tasty Haskell UI framework ๐
miso is a fast, composable Haskell library for building web and native user interfaces. Compiles to WebAssembly or JavaScript.
git clone https://github.com/haskell-miso/miso-sampler && cd miso-samplernix develop .#wasm --command bash -c 'make all && make serve'Compile to WebAssembly or JavaScript. Virtual DOM, event delegation, hydration and server-side rendering out of the box.
โShip native iOS, Android and HarmonyOS apps via LynxJS.org. See the native section.
โLynxtron brings Lynx to the desktop, Electron-style. The same miso components will run there unchanged.
โA model, an update function and a view. That is a Component, and a whole application.
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 countermiso borrows the best ideas from React and Elm and gives them Haskell types.
A keyed diffing algorithm patches only what changed. Fragments, keyed lists and lifecycle hooks included.
Self-contained model, update and view. Nest them, pass props, share a global context, or send mail.
Context, Fragments, Props and other familiar React concepts, implemented in Haskell.
Typed combinators for every HTML, SVG and MathML element, plus a structured CSS DSL with keyframes and media queries.
One listener on <body> routes capture and bubble phases through the virtual DOM to typed handlers.
Render a View to HTML on the server or at build time; the client hydrates instead of redrawing.
Derive a bidirectional router from a plain sum type. Links and parsers can never disagree.
IO is scheduled, never run, inside update. Timers, sockets and browser events are subscriptions.
Typed access to the browser's networking: the Fetch API, WebSockets and server-sent events.
Talk to any browser API with a typed DSL or inline JavaScript quasi-quotes.
miso only depends on GHC boot packages that are delivered with the compiler distribution itself.
Build iOS, Android and HarmonyOS applications. See the native section.
From launch in 2016 to native mobile apps and React-style primitives today.
8 years in production
The simplicity of miso's API makes it an ideal tool for AI agents like Claude, Codex, and Kimi K3, etc.
โฆ Agent-friendly by design ยท 100% misoGames, browser API demos, integrations and libraries, all written in miso.