hyperbole-0.6.0: Interactive HTML apps using type-safe serverside Haskell
Safe HaskellSafe-Inferred
LanguageGHC2021

Web.Hyperbole.HyperView

Synopsis

Documentation

get :: forall s (es :: [Effect]). (HasCallStack, State s :> es) => Eff es s #

Fetch the current value of the state.

put :: forall s (es :: [Effect]). (HasCallStack, State s :> es) => s -> Eff es () #

Set the current state to the given value.

gets :: forall s (es :: [Effect]) a. (HasCallStack, State s :> es) => (s -> a) -> Eff es a #

Get a function of the current state.

gets f ≡ f <$> get

modify :: forall s (es :: [Effect]). (HasCallStack, State s :> es) => (s -> s) -> Eff es () #

Apply the function to the current state.

modify f ≡ state (\s -> ((), f s))

state :: forall s (es :: [Effect]) a. (HasCallStack, State s :> es) => (s -> (a, s)) -> Eff es a #

Apply the function to the current state and return a value.

data State s (a :: Type -> Type) b #

Provide access to a mutable value of type s.

Instances

Instances details
ViewState view ~ st => HasViewId (Eff (Reader view ': (State st ': es)) :: Type -> Type) (view :: Type) Source # 
Instance details

Defined in Web.Hyperbole.View.Types

Methods

viewId :: Eff (Reader view ': (State st ': es)) view Source #

type DispatchOf (State s) 
Instance details

Defined in Effectful.Internal.MTL