Framework agnostic web views. Instead of writing views in a concrete HTML
type, write them in a polymorphic way and then render or embed them in any framework that provides an implementation.
Currently available implementations:
Further libraries:
Main.purs:
module Main where
import Prelude
import Chameleon as C
data Msg
= Increment Int
| Decrement Int
view :: forall html. C.Html html => { count :: Int } -> html Msg
view props =
C.div
[ C.style "border: 1px solid red"
]
[ C.text "Counter"
, C.div [] [ C.text $ show props.count ]
, C.button [ C.onClick (Increment 1) ]
[ C.text "+" ]
, C.button [ C.onClick (Decrement 1) ]
[ C.text "-" ]
]