Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- runJSorWarp :: Int -> JSM () -> IO ()
- runJSorWarpWithIndex :: ByteString -> Int -> JSM () -> IO ()
- data Env
- type Port = Int
- liveWithBackend :: Port -> JSM () -> IO Application -> IO ()
- liveWithBackendAndIndex :: ByteString -> Port -> JSM () -> IO Application -> IO ()
- liveWithStatic :: Port -> JSM () -> FilePath -> IO ()
- liveWithStaticAndIndex :: ByteString -> Port -> JSM () -> FilePath -> IO ()
- live :: Port -> JSM () -> IO ()
- liveWithIndex :: ByteString -> Port -> JSM () -> IO ()
- fullPage :: Backend b m a => Monad (b m) => Eq a => (m ~> JSM) -> (TVar a -> b m ~> m) -> a -> (a -> Html (b m) a) -> b m RawNode -> JSM ()
- fullPageJSM :: Backend b JSM a => Monad (b JSM) => Eq a => (TVar a -> b JSM ~> JSM) -> a -> (a -> Html (b JSM) a) -> b JSM RawNode -> JSM ()
- simple :: Backend b JSM a => Monad (b JSM) => Eq a => (TVar a -> b JSM ~> JSM) -> a -> (a -> Html (b JSM) a) -> b JSM RawNode -> JSM ()
- entrypoint :: Env -> Text
Agnostic Run
runJSorWarp :: Int -> JSM () -> IO () Source #
Start the program!
This function works in GHC and GHCjs. I saved you from using C preprocessor directly. You're welcome.
runJSorWarpWithIndex :: ByteString -> Int -> JSM () -> IO () Source #
Start the program (with a custom index.html
)!
This function works in GHC and GHCjs. I saved you from using C preprocessor directly. You're welcome.
Live Reloads
:: Port | Port to serve the live server |
-> JSM () | Frontend application |
-> IO Application | Server API |
-> IO () |
Serve a web server and a jsaddle warp frontend at the same time.
This is useful for live reloads for development purposes.
For example:
ghcid -c "cabal repl dev" -W -T "Main.main"
liveWithBackendAndIndex Source #
:: ByteString | Custom |
-> Port | Port to serve the live server |
-> JSM () | Frontend application |
-> IO Application | Server API |
-> IO () |
Identical to liveWithBackend
, but with a custom index.html
file.
:: Port | Port to serve the live server |
-> JSM () | Frontend application |
-> FilePath | Path to static files |
-> IO () |
Serve jsaddle warp frontend with a static file server.
liveWithStaticAndIndex Source #
:: ByteString | Custom |
-> Port | Port to serve the live server |
-> JSM () | Frontend application |
-> FilePath | Path to static files |
-> IO () |
Identical to liveWithStatic
, but with a custom index.html
file.
Serve jsaddle warp frontend.
This is useful for live reloads for development purposes.
For example:
ghcid -c "cabal repl" -W -T "Main.dev"
:: ByteString | Custom |
-> Port | Port to serve the live server |
-> JSM () | Frontend application |
-> IO () |
Identical to live
, but with a custom index.html
file.
Convenience Variants
:: Backend b m a | |
=> Monad (b m) | |
=> Eq a | |
=> (m ~> JSM) | How do we get to JSM? |
-> (TVar a -> b m ~> m) | What backend are we running? |
-> a | What is the initial state? |
-> (a -> Html (b m) a) | How should the html look? |
-> b m RawNode | Where do we render? |
-> JSM () |
Wrapper around shpadoinkle
for full page apps
that do not need outside control of the territory
:: Backend b JSM a | |
=> Monad (b JSM) | |
=> Eq a | |
=> (TVar a -> b JSM ~> JSM) | What backend are we running? |
-> a | What is the initial state? |
-> (a -> Html (b JSM) a) | How should the html look? |
-> b JSM RawNode | Where do we render? |
-> JSM () |
fullPageJSM
is a wrapper around shpadoinkle
for full page apps that do not need outside control
of the territory, where actions are performed directly in JSM.
This set of assumptions is extremely common when starting a new project.
:: Backend b JSM a | |
=> Monad (b JSM) | |
=> Eq a | |
=> (TVar a -> b JSM ~> JSM) | What backend are we running? |
-> a | what is the initial state? |
-> (a -> Html (b JSM) a) | how should the html look? |
-> b JSM RawNode | where do we render? |
-> JSM () |
Simple app
(a good starting place)
entrypoint :: Env -> Text Source #