| Copyright | (c) Leon Vatthauer 2026 |
|---|---|
| License | GPL-3 |
| Maintainer | Leon Vatthauer <leon.vatthauer@fau.de> |
| Stability | experimental |
| Portability | non-portable (ghc-wasm-meta) |
| Safe Haskell | None |
| Language | GHC2024 |
App.Model
Contents
Description
This module defines the application Model.
Synopsis
- data DropLocation where
- data SpawnType where
- data Logic
- canSpawnBefore :: NodeAddr -> SpawnType -> Bool
- data Action where
- InitMathJAX :: DOMRef -> Action
- OpenTooltip :: MisoString -> Bool -> Action
- CloseTooltip :: Action
- ToggleSidebar :: Action
- SetProof :: Proof -> Action
- PopState :: URI -> Action
- Setup :: Action
- Focus :: Either NodeAddr NodeAddr -> Action
- Blur :: Either NodeAddr NodeAddr -> Action
- Input :: MisoString -> DOMRef -> Action
- ProcessInput :: MisoString -> Int -> Int -> Either NodeAddr NodeAddr -> Action
- Change :: Action
- Drop :: DropLocation -> Action
- DragEnter :: NodeAddr -> Action
- DragLeave :: Action
- DragStart :: Either NodeAddr ProofAddr -> Action
- DragEnd :: Action
- SpawnStart :: SpawnType -> Action
- NavigateForward :: Action
- NavigateBackward :: Action
- Resize :: Bool -> Action
- Nop :: Action
- type Pos = Int
- data Model = Model {
- _focusedLine :: Maybe (Either NodeAddr NodeAddr)
- _exampleProofs :: [(Text, Proof)]
- _emptyDerivation :: Derivation
- _proof :: Proof
- _sidebarToggle :: Bool
- _dragTarget :: Maybe (Either NodeAddr ProofAddr)
- _lastDragged :: Maybe NodeAddr
- _spawnType :: Maybe SpawnType
- _currentHoverLine :: Maybe NodeAddr
- _dragging :: Bool
- _operators :: [(Text, Text, Int)]
- _infixPreds :: [(Text, Text)]
- _quantifiers :: [(Text, Text)]
- _functionSymbols :: Map Text (Int, Pos)
- _predicateSymbols :: Map Text (Int, Pos)
- _rules :: [(Name, RuleSpec)]
- _uri :: URI
- _logic :: Logic
- _currentTooltip :: Maybe MisoString
- _onMobile :: Bool
- initialModel :: Derivation -> Proof -> [(Text, Proof)] -> [(Text, Text, Int)] -> [(Text, Text)] -> [(Text, Text)] -> [(Name, RuleSpec)] -> URI -> Logic -> Maybe Bool -> Bool -> Model
- focusedLine :: Lens Model (Maybe (Either NodeAddr NodeAddr))
- exampleProofs :: Lens Model [(Text, Proof)]
- emptyDerivation :: Lens Model Derivation
- proof :: Lens Model Proof
- sidebarToggle :: Lens Model Bool
- dragTarget :: Lens Model (Maybe (Either NodeAddr ProofAddr))
- lastDragged :: Lens Model (Maybe NodeAddr)
- spawnType :: Lens Model (Maybe SpawnType)
- currentHoverLine :: Lens Model (Maybe NodeAddr)
- dragging :: Lens Model Bool
- operators :: Lens Model [(Text, Text, Int)]
- infixPreds :: Lens Model [(Text, Text)]
- quantifiers :: Lens Model [(Text, Text)]
- functionSymbols :: Lens Model (Map Text (Int, Pos))
- predicateSymbols :: Lens Model (Map Text (Int, Pos))
- rules :: Lens Model [(Name, RuleSpec)]
- uri :: Lens Model URI
- logic :: Lens Model Logic
- currentTooltip :: Lens Model (Maybe MisoString)
- onMobile :: Lens Model Bool
Data Types
data DropLocation where Source #
Specifies the location where a Assumption, Derivation or
tProof has been dropped.
Constructors
| LineAddr :: NodeAddr -> DropLocation | Dropped before a |
| LocationBin :: DropLocation | Dropped in the bin. |
Instances
| Show DropLocation Source # | |
Defined in App.Model Methods showsPrec :: Int -> DropLocation -> ShowS # show :: DropLocation -> String # showList :: [DropLocation] -> ShowS # | |
| Eq DropLocation Source # | |
Defined in App.Model | |
Specifies whether a Assumption, Derivation or a Proof should be spawned.
Constructors
| SpawnLine :: SpawnType | Spawn a |
| SpawnProof :: SpawnType | Spawn a |
Enumeration of Logics that the app supports.
canSpawnBefore :: NodeAddr -> SpawnType -> Bool Source #
Returns whether a given SpawnType can be spawned before a NodeAddr.
For example, a Proof can be spawned before a NAConclusion,
but not before a NAAssumption.
The actions of the application.
Constructors
| InitMathJAX :: DOMRef -> Action | Start MathJAX on the given |
| OpenTooltip :: MisoString -> Bool -> Action | Open the tooltip with given |
| CloseTooltip :: Action | Close the currently opened tooltip element with given |
| ToggleSidebar :: Action | Toggle the sidebar. |
| SetProof :: Proof -> Action | Update the |
| PopState :: URI -> Action | Pop a state of the history, see https://developer.mozilla.org/en-US/docs/Web/API/History_API. |
| Setup :: Action | Setup directly called after application is mounted. |
| Focus :: Either NodeAddr NodeAddr -> Action | Focus a |
| Blur :: Either NodeAddr NodeAddr -> Action | Blur a |
| Input :: MisoString -> DOMRef -> Action | Handle input text to |
| ProcessInput :: MisoString -> Int -> Int -> Either NodeAddr NodeAddr -> Action | Same as |
| Change :: Action | Handle changes to |
| Drop :: DropLocation -> Action | Drop currently dragged element into |
| DragEnter :: NodeAddr -> Action | Called when the drop-zone at a |
| DragLeave :: Action | Called when a drop-zone is left. |
| DragStart :: Either NodeAddr ProofAddr -> Action | Called when dragging of a |
| DragEnd :: Action | Called when dragging ends. |
| SpawnStart :: SpawnType -> Action | Called when spawning starts with given |
| NavigateForward :: Action | |
| NavigateBackward :: Action | Navigate backward in the history |
| Resize :: Bool -> Action | Action fired when the window gets resized https://developer.mozilla.org/en-US/docs/Web/API/Window/resize_event |
| Nop :: Action | No op. |
Model
The Model of the application.
Constructors
| Model | |
Fields
| |
Arguments
| :: Derivation | Empty |
| -> Proof | Initial |
| -> [(Text, Proof)] | Example |
| -> [(Text, Text, Int)] | A list of operators (alias, operator, arity) |
| -> [(Text, Text)] | A list of quantifiers (alias, quantifier) |
| -> [(Text, Text)] | A list of infix predicates (alias, predicate) |
| -> [(Name, RuleSpec)] | The map of rules |
| -> URI | The current |
| -> Logic | Logic that the app uses. |
| -> Maybe Bool | Initial state of onMobile |
| -> Bool | Possibly a previous sidebarToggle state. |
| -> Model | Initial |
Lenses
Generated using makeLenses.