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 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.
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.
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% misoGames, browser API demos, integrations and libraries, all written in miso.