| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
NanoUI.Emit
Description
Widgets for reducer-style applications.
Each function draws a widget from the model and, when the user changes it,
emits a message instead of returning the new value. The backend's reducer
runner (runSdlAppReduce, runRgfwAppReduce) folds the frame's messages
into the model with your update function.
The names match NanoUI, so import this module qualified:
import NanoUI.Emit qualified as Emit data Msg = Increment | Decrement view :: Int -> NanoUI () view n = row $ do Emit.button "-" Decrement label (T.pack (show n)) Emit.button "+" Increment
Synopsis
- emit :: forall msg (es :: [Effect]). (Typeable msg, Ui :> es) => msg -> Eff es ()
- button :: forall msg (es :: [Effect]). (Typeable msg, Ui :> es) => Text -> msg -> Eff es ()
- checkbox :: forall msg (es :: [Effect]). (Typeable msg, Ui :> es) => Text -> Bool -> (Bool -> msg) -> Eff es ()
- slider :: forall msg (es :: [Effect]). (Typeable msg, Ui :> es) => Float -> Float -> Float -> (Float -> msg) -> Eff es ()
- select :: forall f msg (es :: [Effect]). (Foldable f, Typeable msg, Ui :> es) => f Text -> Int -> (Int -> msg) -> Eff es ()
- radio :: forall f msg (es :: [Effect]). (Foldable f, Typeable msg, Ui :> es) => f Text -> Int -> (Int -> msg) -> Eff es ()
- textInput :: forall msg (es :: [Effect]). (Typeable msg, Ui :> es) => Text -> (Text -> msg) -> Eff es ()
- textArea :: forall msg (es :: [Effect]). (Typeable msg, Ui :> es) => Text -> (Text -> msg) -> Eff es ()
- tabs :: forall f a msg (es :: [Effect]). (Foldable f, Eq a, Typeable msg, Ui :> es) => a -> f (Tab a (Eff es ())) -> (a -> msg) -> Eff es ()
Documentation
button :: forall msg (es :: [Effect]). (Typeable msg, Ui :> es) => Text -> msg -> Eff es () Source #
Emit msg when the button is clicked.
checkbox :: forall msg (es :: [Effect]). (Typeable msg, Ui :> es) => Text -> Bool -> (Bool -> msg) -> Eff es () Source #
slider :: forall msg (es :: [Effect]). (Typeable msg, Ui :> es) => Float -> Float -> Float -> (Float -> msg) -> Eff es () Source #
select :: forall f msg (es :: [Effect]). (Foldable f, Typeable msg, Ui :> es) => f Text -> Int -> (Int -> msg) -> Eff es () Source #
radio :: forall f msg (es :: [Effect]). (Foldable f, Typeable msg, Ui :> es) => f Text -> Int -> (Int -> msg) -> Eff es () Source #
textInput :: forall msg (es :: [Effect]). (Typeable msg, Ui :> es) => Text -> (Text -> msg) -> Eff es () Source #