module IHP.ServerSideComponent.Types where
import IHP.ViewPrelude
import qualified Network.WebSockets as WebSocket
class Component state action | state -> action where
initialState :: state
render :: state -> Html
action ::
( ?instanceRef :: IORef (ComponentInstance state)
, ?connection :: WebSocket.Connection
, ?context :: ControllerContext
, ?modelContext :: ModelContext
) => state -> action -> IO state
componentDidMount ::
( ?instanceRef :: IORef (ComponentInstance state)
, ?connection :: WebSocket.Connection
, ?context :: ControllerContext
, ?modelContext :: ModelContext
) => state -> IO state
componentDidMount state
state = state -> IO state
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure state
state
data ComponentsController components
= ComponentsController
deriving (ComponentsController components
-> ComponentsController components -> Bool
(ComponentsController components
-> ComponentsController components -> Bool)
-> (ComponentsController components
-> ComponentsController components -> Bool)
-> Eq (ComponentsController components)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall k (components :: k).
ComponentsController components
-> ComponentsController components -> Bool
$c== :: forall k (components :: k).
ComponentsController components
-> ComponentsController components -> Bool
== :: ComponentsController components
-> ComponentsController components -> Bool
$c/= :: forall k (components :: k).
ComponentsController components
-> ComponentsController components -> Bool
/= :: ComponentsController components
-> ComponentsController components -> Bool
Eq, Int -> ComponentsController components -> ShowS
[ComponentsController components] -> ShowS
ComponentsController components -> String
(Int -> ComponentsController components -> ShowS)
-> (ComponentsController components -> String)
-> ([ComponentsController components] -> ShowS)
-> Show (ComponentsController components)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall k (components :: k).
Int -> ComponentsController components -> ShowS
forall k (components :: k).
[ComponentsController components] -> ShowS
forall k (components :: k).
ComponentsController components -> String
$cshowsPrec :: forall k (components :: k).
Int -> ComponentsController components -> ShowS
showsPrec :: Int -> ComponentsController components -> ShowS
$cshow :: forall k (components :: k).
ComponentsController components -> String
show :: ComponentsController components -> String
$cshowList :: forall k (components :: k).
[ComponentsController components] -> ShowS
showList :: [ComponentsController components] -> ShowS
Show, Typeable (ComponentsController components)
Typeable (ComponentsController components)
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> ComponentsController components
-> c (ComponentsController components))
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c (ComponentsController components))
-> (ComponentsController components -> Constr)
-> (ComponentsController components -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d))
-> Maybe (c (ComponentsController components)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ComponentsController components)))
-> ((forall b. Data b => b -> b)
-> ComponentsController components
-> ComponentsController components)
-> (forall r r'.
(r -> r' -> r)
-> r
-> (forall d. Data d => d -> r')
-> ComponentsController components
-> r)
-> (forall r r'.
(r' -> r -> r)
-> r
-> (forall d. Data d => d -> r')
-> ComponentsController components
-> r)
-> (forall u.
(forall d. Data d => d -> u)
-> ComponentsController components -> [u])
-> (forall u.
Int
-> (forall d. Data d => d -> u)
-> ComponentsController components
-> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> ComponentsController components
-> m (ComponentsController components))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ComponentsController components
-> m (ComponentsController components))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ComponentsController components
-> m (ComponentsController components))
-> Data (ComponentsController components)
ComponentsController components -> Constr
ComponentsController components -> DataType
(forall b. Data b => b -> b)
-> ComponentsController components
-> ComponentsController components
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int
-> (forall d. Data d => d -> u)
-> ComponentsController components
-> u
forall u.
(forall d. Data d => d -> u)
-> ComponentsController components -> [u]
forall {k} {components :: k}.
(Typeable components, Typeable k) =>
Typeable (ComponentsController components)
forall k (components :: k).
(Typeable components, Typeable k) =>
ComponentsController components -> Constr
forall k (components :: k).
(Typeable components, Typeable k) =>
ComponentsController components -> DataType
forall k (components :: k).
(Typeable components, Typeable k) =>
(forall b. Data b => b -> b)
-> ComponentsController components
-> ComponentsController components
forall k (components :: k) u.
(Typeable components, Typeable k) =>
Int
-> (forall d. Data d => d -> u)
-> ComponentsController components
-> u
forall k (components :: k) u.
(Typeable components, Typeable k) =>
(forall d. Data d => d -> u)
-> ComponentsController components -> [u]
forall k (components :: k) r r'.
(Typeable components, Typeable k) =>
(r -> r' -> r)
-> r
-> (forall d. Data d => d -> r')
-> ComponentsController components
-> r
forall k (components :: k) r r'.
(Typeable components, Typeable k) =>
(r' -> r -> r)
-> r
-> (forall d. Data d => d -> r')
-> ComponentsController components
-> r
forall k (components :: k) (m :: * -> *).
(Typeable components, Typeable k, Monad m) =>
(forall d. Data d => d -> m d)
-> ComponentsController components
-> m (ComponentsController components)
forall k (components :: k) (m :: * -> *).
(Typeable components, Typeable k, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> ComponentsController components
-> m (ComponentsController components)
forall k (components :: k) (c :: * -> *).
(Typeable components, Typeable k) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c (ComponentsController components)
forall k (components :: k) (c :: * -> *).
(Typeable components, Typeable k) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> ComponentsController components
-> c (ComponentsController components)
forall k (components :: k) (t :: * -> *) (c :: * -> *).
(Typeable components, Typeable k, Typeable t) =>
(forall d. Data d => c (t d))
-> Maybe (c (ComponentsController components))
forall k (components :: k) (t :: * -> * -> *) (c :: * -> *).
(Typeable components, Typeable k, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ComponentsController components))
forall r r'.
(r -> r' -> r)
-> r
-> (forall d. Data d => d -> r')
-> ComponentsController components
-> r
forall r r'.
(r' -> r -> r)
-> r
-> (forall d. Data d => d -> r')
-> ComponentsController components
-> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> ComponentsController components
-> m (ComponentsController components)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ComponentsController components
-> m (ComponentsController components)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c (ComponentsController components)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> ComponentsController components
-> c (ComponentsController components)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d))
-> Maybe (c (ComponentsController components))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ComponentsController components))
$cgfoldl :: forall k (components :: k) (c :: * -> *).
(Typeable components, Typeable k) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> ComponentsController components
-> c (ComponentsController components)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> ComponentsController components
-> c (ComponentsController components)
$cgunfold :: forall k (components :: k) (c :: * -> *).
(Typeable components, Typeable k) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c (ComponentsController components)
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c (ComponentsController components)
$ctoConstr :: forall k (components :: k).
(Typeable components, Typeable k) =>
ComponentsController components -> Constr
toConstr :: ComponentsController components -> Constr
$cdataTypeOf :: forall k (components :: k).
(Typeable components, Typeable k) =>
ComponentsController components -> DataType
dataTypeOf :: ComponentsController components -> DataType
$cdataCast1 :: forall k (components :: k) (t :: * -> *) (c :: * -> *).
(Typeable components, Typeable k, Typeable t) =>
(forall d. Data d => c (t d))
-> Maybe (c (ComponentsController components))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d))
-> Maybe (c (ComponentsController components))
$cdataCast2 :: forall k (components :: k) (t :: * -> * -> *) (c :: * -> *).
(Typeable components, Typeable k, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ComponentsController components))
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ComponentsController components))
$cgmapT :: forall k (components :: k).
(Typeable components, Typeable k) =>
(forall b. Data b => b -> b)
-> ComponentsController components
-> ComponentsController components
gmapT :: (forall b. Data b => b -> b)
-> ComponentsController components
-> ComponentsController components
$cgmapQl :: forall k (components :: k) r r'.
(Typeable components, Typeable k) =>
(r -> r' -> r)
-> r
-> (forall d. Data d => d -> r')
-> ComponentsController components
-> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r
-> (forall d. Data d => d -> r')
-> ComponentsController components
-> r
$cgmapQr :: forall k (components :: k) r r'.
(Typeable components, Typeable k) =>
(r' -> r -> r)
-> r
-> (forall d. Data d => d -> r')
-> ComponentsController components
-> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r
-> (forall d. Data d => d -> r')
-> ComponentsController components
-> r
$cgmapQ :: forall k (components :: k) u.
(Typeable components, Typeable k) =>
(forall d. Data d => d -> u)
-> ComponentsController components -> [u]
gmapQ :: forall u.
(forall d. Data d => d -> u)
-> ComponentsController components -> [u]
$cgmapQi :: forall k (components :: k) u.
(Typeable components, Typeable k) =>
Int
-> (forall d. Data d => d -> u)
-> ComponentsController components
-> u
gmapQi :: forall u.
Int
-> (forall d. Data d => d -> u)
-> ComponentsController components
-> u
$cgmapM :: forall k (components :: k) (m :: * -> *).
(Typeable components, Typeable k, Monad m) =>
(forall d. Data d => d -> m d)
-> ComponentsController components
-> m (ComponentsController components)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> ComponentsController components
-> m (ComponentsController components)
$cgmapMp :: forall k (components :: k) (m :: * -> *).
(Typeable components, Typeable k, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> ComponentsController components
-> m (ComponentsController components)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ComponentsController components
-> m (ComponentsController components)
$cgmapMo :: forall k (components :: k) (m :: * -> *).
(Typeable components, Typeable k, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> ComponentsController components
-> m (ComponentsController components)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ComponentsController components
-> m (ComponentsController components)
Data)
data ComponentInstance state
= ComponentInstance { forall state. ComponentInstance state -> state
state :: state }
instance (SetField "state" (ComponentInstance state) state) where
setField :: state -> ComponentInstance state -> ComponentInstance state
setField state
state ComponentInstance state
componentInstance = ComponentInstance state
componentInstance { state
$sel:state:ComponentInstance :: state
state :: state
state }