diff options
author | Ben Sima <ben@bsima.me> | 2020-12-06 10:04:08 -0500 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2020-12-06 10:04:08 -0500 |
commit | 83c473947589cd90fc74fb59e9c9c28a677583c3 (patch) | |
tree | cbe7ae61b5f6cf7a1be4b2c7d7fcb5c516c73234 /Biz/Devalloc/Node.hs | |
parent | ed4778e3bc72d1995ae88c36486a546118f7aa2d (diff) |
Finish Devalloc miso app prototype
After hours of trying to get a page abstraction working in a Miso app (both
Devalloc and Hero) I had a revelation: Miso is an SPA - *single* page
application - framework, and so trying to put multiple pages into it is
fundamentally at odds with the rest of the architecture.
Of course this is also a problem with Elm's pattern of nesting models in order
to create a page abstraction. They can pull it off because they don't also try
to do isomorphic rendering.
In hindsight this should be obvious... if I actually do want some kind of
page-like abstraction or separation, then I need a much more complex server that
can embed different Miso apps based on some logic. But this is more like
multi-tenancy, or something.
Also I'm starting to think that I don't want Devalloc to be an SPA anyway, so
I'll try an experimental branch where I rip it out and just use Servant, Lucid,
and Turbolinks.
Diffstat (limited to 'Biz/Devalloc/Node.hs')
-rw-r--r-- | Biz/Devalloc/Node.hs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Biz/Devalloc/Node.hs b/Biz/Devalloc/Node.hs new file mode 100644 index 0000000..51acbf1 --- /dev/null +++ b/Biz/Devalloc/Node.hs @@ -0,0 +1,32 @@ +{-# LANGUAGE NoImplicitPrelude #-} +{-# LANGUAGE RecordWildCards #-} + +-- : out devalloc.js +-- +-- : dep clay +-- : dep ghcjs-base +-- : dep miso +-- : dep potolude +-- : dep servant +-- : dep text +module Biz.Devalloc.Node (main) where + +import Alpha +import qualified Biz.Devalloc.Core as Core +import Miso + +main :: IO () +main = miso <| \currentURI -> App {model = Core.make currentURI, ..} + where + update = move + view = view + subs = [] + events = defaultEvents + initialAction = Core.NoOp + mountPoint = Nothing + +move :: Core.Move -> Core.Form -> Effect Core.Move Core.Form +move mov form = case mov of + Core.NoOp -> noEff form + Core.ChangeURI u -> form <# (pushURI u >> pure Core.NoOp) + |