NixLabConnectionconnecting
ProjectsProject
web /

dreamstop.openfp.net

publicguest

dreamstop.openfp.net, the website and user manual of dreamstop, a language for continuous disambiguation

git clone git@nixlab.openfp.net:web/dreamstop.openfp.net.git
9587956330ef3ffa03af9df75b0021c885ff5d5cdreamstop-openfp-net-web/src/Site/View.hs
-- | The page's body: what dreamstop is, the three verdicts, a minimal pair,
-- and the manual.
-- Every word is in the rendered HTML, so the page reads in full without
-- JavaScript. Every sentence of prose is annotated in prose/front.vx.
--
-- @since 0.1.0.0
module Site.View
  ( Model
  , Action
  , app
  ) where

import           Data.Kind          (Type)
import           DesignKit.Brand    (fontDisplay, gradientText)
import           DesignKit.Effects  (scrollProgressBar)
import           Miso               (App, Effect, component)
import           Miso.Html.Element  (a_, blockquote_, code_, div_, footer_, h1_,
                                     h2_, h3_, header_, li_, nav_, p_, section_,
                                     span_, ul_)
import           Miso.Html.Property (aria_, href_, id_)
import           Miso.Property      (classList)
import           Miso.Types         (View, text)
import           Site.Content       (Side (sideAnnotation, sideLabel, sideSentence),
                                     Verdict (verdictAnnotations, verdictName, verdictSentence, verdictText),
                                     manual, package, pair, pairSlot,
                                     repository, verdicts)
import           Site.Page          (name)

-- | The page holds no state.
--
-- @since 0.1.0.0
type Model :: Type
data Model = MkModel
  deriving stock (Eq)

-- | The page has no actions.
--
-- @since 0.1.0.0
type Action :: Type
data Action

-- | Rendered and hydrated with the same view.
--
-- @since 0.1.0.0
app :: App Model Action
app = component MkModel update (const view)

update :: Action -> Effect parent props Model Action
update = \case {}

view :: Model -> View Model Action
view _ =
  div_
    [classList ["page"]]
    [ scrollProgressBar
    , header_
        [classList ["chrome"]]
        [ div_
            [classList ["container"]]
            [ wordmark
            , nav_
                [classList ["links"], aria_ "label" "Site"]
                [ a_ [href_ "#verdicts"] ["Verdicts"]
                , a_ [href_ "#pairs"] ["Minimal pairs"]
                , a_ [href_ manual] ["Manual"]
                ]
            ]
        ]
    , section_
        [classList ["hero"]]
        [ div_
            [classList ["container"]]
            [ h1_ [classList ["display"], fontDisplay] [gradientText [text name]]
            , p_ [classList ["lead"]] ["dreamstop is a language for continuous disambiguation."]
            , p_
                []
                [ "It secures one property. \
                  \Every question a reader is entitled to ask of a document has exactly one answer. \
                  \A reader annotates each clause of a sentence with three-letter codes. \
                  \Each annotation records one reading of the sentence. \
                  \A sentence is clear when every reader finds the same single reading. \
                  \It is ambiguous when the readings differ. \
                  \It is nonsense when every reader finds no coherent reading. \
                  \Every review counts the answers to each question, and the author rewrites any text that leaves a question open."
                ]
            , p_
                [classList ["actions"]]
                [a_ [classList ["btn"], id_ "manual", href_ manual] ["Read the manual"]]
            ]
        ]
    , section_
        [classList ["band"], id_ "verdicts"]
        [ div_
            [classList ["container"]]
            [ h2_ [classList ["section-title"], fontDisplay] ["Clear, ambiguous or nonsense"]
            , ul_ [classList ["readings"]] (map verdict verdicts)
            ]
        ]
    , section_
        [classList ["band"], id_ "pairs"]
        [ div_
            [classList ["container"]]
            [ h2_ [classList ["section-title"], fontDisplay] ["Minimal pairs"]
            , p_
                []
                [ "A minimal pair is a question, a bad side that leaves it open, a good side that answers it, and the smallest edit between them." ]
            , ul_ [classList ["readings"]] (map side pair)
            , p_ [classList ["annotation"]] [text pairSlot]
            , p_
                []
                [ "This pair teaches that a ChangeLog describes the resulting state, not the migration. \
                  \Each document kind is a set of patterns, specified by its pairs. \
                  \A pattern with no pair is not part of the kind."
                ]
            , p_
                []
                [ "The manual covers every code, the clause positions, the verdicts, the questions, the six document kinds and how reviews use them. "
                , "The dreamstop package in dreamstop/dreamstop checks every pair of a kind against its patterns."
                ]
            ]
        ]
    , footer_
        [classList ["chrome"]]
        [ div_
            [classList ["container"]]
            [ wordmark
            , span_
                [classList ["copy"]]
                [ a_ [href_ repository] ["Page source"]
                , ". "
                , a_ [href_ package] ["Package source"]
                , ". © 2026 Homotopic.Tech Ltd. An "
                , a_ [href_ "https://openfp.net"] ["openfp"]
                , " project."
                ]
            ]
        ]
    ]
  where
    wordmark :: View Model Action
    wordmark = a_ [classList ["wordmark"], href_ "/"] [text name]

    verdict :: Verdict -> View Model Action
    verdict v =
      li_
        []
        ( [ h3_ [] [text (verdictName v)]
          , blockquote_ [classList ["entry"]] [text (verdictSentence v)]
          ]
            <> map (\a -> p_ [classList ["annotation"]] [code_ [] [text a]]) (verdictAnnotations v)
            <> [p_ [] [text (verdictText v)]]
        )

    side :: Side -> View Model Action
    side s =
      li_
        []
        [ h3_ [] [text (sideLabel s)]
        , blockquote_ [classList ["entry"]] [text (sideSentence s)]
        , p_ [classList ["annotation"]] [code_ [] [text (sideAnnotation s)]]
        ]