Finch
Copyright(c) Leon Vatthauer 2026
LicenseGPL-3
MaintainerLeon Vatthauer <leon.vatthauer@fau.de>
Stabilityexperimental
Portabilitynon-portable (ghc-wasm-meta)
Safe HaskellNone
LanguageGHC2024

App.Model

Description

This module defines the application Model.

Synopsis

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 NodeAddr.

LocationBin :: DropLocation

Dropped in the bin.

Instances

Instances details
Show DropLocation Source # 
Instance details

Defined in App.Model

Eq DropLocation Source # 
Instance details

Defined in App.Model

data SpawnType where Source #

Specifies whether a Assumption, Derivation or a Proof should be spawned.

Instances

Instances details
Show SpawnType Source # 
Instance details

Defined in App.Model

Eq SpawnType Source # 
Instance details

Defined in App.Model

data Logic Source #

Enumeration of Logics that the app supports.

Constructors

Prop 
FOL 

Instances

Instances details
Show Logic Source # 
Instance details

Defined in App.Model

Methods

showsPrec :: Int -> Logic -> ShowS #

show :: Logic -> String #

showList :: [Logic] -> ShowS #

Eq Logic Source # 
Instance details

Defined in App.Model

Methods

(==) :: Logic -> Logic -> Bool #

(/=) :: Logic -> Logic -> Bool #

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.

data Action where Source #

The actions of the application.

Constructors

InitMathJAX :: DOMRef -> Action

Start MathJAX on the given DOMRef

OpenTooltip :: MisoString -> Bool -> Action

Open the tooltip with given id. Takes a Bool, that turns the action into a Noop, when False.

CloseTooltip :: Action

Close the currently opened tooltip element with given id.

ToggleSidebar :: Action

Toggle the sidebar.

SetProof :: Proof -> Action

Update the Proof.

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 Formula or RuleApplication input field.

Blur :: Either NodeAddr NodeAddr -> Action

Blur a Formula or RuleApplication input field.

Input :: MisoString -> DOMRef -> Action

Handle input text to input field.

ProcessInput :: MisoString -> Int -> Int -> Either NodeAddr NodeAddr -> Action

Same as Input but with more information.

Change :: Action

Handle changes to input field, triggers only, after field loses focus.

Drop :: DropLocation -> Action

Drop currently dragged element into DropLocation

DragEnter :: NodeAddr -> Action

Called when the drop-zone at a NodeAddr is entered.

DragLeave :: Action

Called when a drop-zone is left.

DragStart :: Either NodeAddr ProofAddr -> Action

Called when dragging of a Assumption, Derivation or Proof begins.

DragEnd :: Action

Called when dragging ends.

SpawnStart :: SpawnType -> Action

Called when spawning starts with given SpawnType.

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.

type Pos = Int Source #

Type for position information.

Model

data Model Source #

The Model of the application.

Constructors

Model 

Fields

Instances

Instances details
Eq Model Source # 
Instance details

Defined in App.Model

Methods

(==) :: Model -> Model -> Bool #

(/=) :: Model -> Model -> Bool #

initialModel Source #

Arguments

:: Derivation

Empty Derivation, used for inserting Assumptions, Derivations and Proofs.

-> Proof

Initial Proof.

-> [(Text, Proof)]

Example Proofs.

-> [(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 URI

-> Logic

Logic that the app uses.

-> Maybe Bool

Initial state of onMobile

-> Bool

Possibly a previous sidebarToggle state.

-> Model

Initial Model with sensible defaults

Generates an initial Model for pre-filling some fields (mostly with Nothing).

Lenses

Generated using makeLenses.