{-# Language GADTs #-}
module Drasil.DocumentLanguage.Definitions (
Field(..), Fields, InclUnits(..), Verbosity(..),
ddefn, derivation, gdefn,
instanceModel, tmodel,
helperRefs, helpToRefField) where
import Data.Map (lookupIndex)
import Data.List (nub)
import Data.Maybe (mapMaybe)
import Control.Lens ((^.))
import Language.Drasil
import Database.Drasil
import SysInfo.Drasil
import Theory.Drasil (DataDefinition, GenDefn, InstanceModel, Theory(..),
TheoryModel, HasInputs(inputs), HasOutput(output, out_constraints), qdFromDD)
import Drasil.DocumentLanguage.Units (toSentenceUnitless)
type Fields = [Field]
data Field = Label
| Symbol
| Units
| DefiningEquation
| Description Verbosity InclUnits
| Input
| Output
| InConstraints
| OutConstraints
| Notes
| Source
| RefBy
data Verbosity = Verbose
| Succinct
data InclUnits = IncludeUnits
| IgnoreUnits
tmodel :: Fields -> SystemInformation -> TheoryModel -> LabelledContent
tmodel :: Fields -> SystemInformation -> TheoryModel -> LabelledContent
tmodel Fields
fs SystemInformation
m TheoryModel
t = RawContent -> Reference -> LabelledContent
mkRawLC (DType -> [(Identifier, [Contents])] -> RawContent
Defini DType
Theory ((Field -> [(Identifier, [Contents])] -> [(Identifier, [Contents])])
-> [(Identifier, [Contents])]
-> Fields
-> [(Identifier, [Contents])]
forall a b. (a -> b -> b) -> b -> [a] -> b
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr (TheoryModel
-> SystemInformation
-> Field
-> [(Identifier, [Contents])]
-> [(Identifier, [Contents])]
mkTMField TheoryModel
t SystemInformation
m) [] Fields
fs)) (TheoryModel -> Reference
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Reference
ref TheoryModel
t)
ddefn :: Fields -> SystemInformation -> DataDefinition -> LabelledContent
ddefn :: Fields -> SystemInformation -> DataDefinition -> LabelledContent
ddefn Fields
fs SystemInformation
m DataDefinition
d = RawContent -> Reference -> LabelledContent
mkRawLC (DType -> [(Identifier, [Contents])] -> RawContent
Defini DType
Data ((Field -> [(Identifier, [Contents])] -> [(Identifier, [Contents])])
-> [(Identifier, [Contents])]
-> Fields
-> [(Identifier, [Contents])]
forall a b. (a -> b -> b) -> b -> [a] -> b
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr (DataDefinition
-> SystemInformation
-> Field
-> [(Identifier, [Contents])]
-> [(Identifier, [Contents])]
mkDDField DataDefinition
d SystemInformation
m) [] Fields
fs)) (DataDefinition -> Reference
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Reference
ref DataDefinition
d)
gdefn :: Fields -> SystemInformation -> GenDefn -> LabelledContent
gdefn :: Fields -> SystemInformation -> GenDefn -> LabelledContent
gdefn Fields
fs SystemInformation
m GenDefn
g = RawContent -> Reference -> LabelledContent
mkRawLC (DType -> [(Identifier, [Contents])] -> RawContent
Defini DType
General ((Field -> [(Identifier, [Contents])] -> [(Identifier, [Contents])])
-> [(Identifier, [Contents])]
-> Fields
-> [(Identifier, [Contents])]
forall a b. (a -> b -> b) -> b -> [a] -> b
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr (GenDefn
-> SystemInformation
-> Field
-> [(Identifier, [Contents])]
-> [(Identifier, [Contents])]
mkGDField GenDefn
g SystemInformation
m) [] Fields
fs)) (GenDefn -> Reference
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Reference
ref GenDefn
g)
instanceModel :: Fields -> SystemInformation -> InstanceModel -> LabelledContent
instanceModel :: Fields -> SystemInformation -> InstanceModel -> LabelledContent
instanceModel Fields
fs SystemInformation
m InstanceModel
i = RawContent -> Reference -> LabelledContent
mkRawLC (DType -> [(Identifier, [Contents])] -> RawContent
Defini DType
Instance ((Field -> [(Identifier, [Contents])] -> [(Identifier, [Contents])])
-> [(Identifier, [Contents])]
-> Fields
-> [(Identifier, [Contents])]
forall a b. (a -> b -> b) -> b -> [a] -> b
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr (InstanceModel
-> SystemInformation
-> Field
-> [(Identifier, [Contents])]
-> [(Identifier, [Contents])]
mkIMField InstanceModel
i SystemInformation
m) [] Fields
fs)) (InstanceModel -> Reference
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Reference
ref InstanceModel
i)
derivation :: (MayHaveDerivation c, HasShortName c, Referable c) => c -> Maybe Contents
derivation :: forall c.
(MayHaveDerivation c, HasShortName c, Referable c) =>
c -> Maybe Contents
derivation c
c = (Derivation -> Contents) -> Maybe Derivation -> Maybe Contents
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap
(\(Derivation Sentence
h [Sentence]
d) -> LabelledContent -> Contents
LlC (LabelledContent -> Contents) -> LabelledContent -> Contents
forall a b. (a -> b) -> a -> b
$ Reference -> RawContent -> LabelledContent
llcc (c -> Reference
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Reference
ref c
c) (RawContent -> LabelledContent) -> RawContent -> LabelledContent
forall a b. (a -> b) -> a -> b
$ Sentence -> [RawContent] -> RawContent
DerivBlock Sentence
h ([RawContent] -> RawContent) -> [RawContent] -> RawContent
forall a b. (a -> b) -> a -> b
$ (Sentence -> RawContent) -> [Sentence] -> [RawContent]
forall a b. (a -> b) -> [a] -> [b]
map Sentence -> RawContent
makeDerivCons [Sentence]
d) (Maybe Derivation -> Maybe Contents)
-> Maybe Derivation -> Maybe Contents
forall a b. (a -> b) -> a -> b
$
c
c c
-> Getting (Maybe Derivation) c (Maybe Derivation)
-> Maybe Derivation
forall s a. s -> Getting a s a -> a
^. Getting (Maybe Derivation) c (Maybe Derivation)
forall c. MayHaveDerivation c => Lens' c (Maybe Derivation)
Lens' c (Maybe Derivation)
derivations
makeDerivCons :: Sentence -> RawContent
makeDerivCons :: Sentence -> RawContent
makeDerivCons (E ModelExpr
e) = ModelExpr -> RawContent
EqnBlock ModelExpr
e
makeDerivCons Sentence
s = Sentence -> RawContent
Paragraph Sentence
s
type ModRow = [(String, [Contents])]
nonEmpty :: b -> ([a] -> b) -> [a] -> b
nonEmpty :: forall b a. b -> ([a] -> b) -> [a] -> b
nonEmpty b
def [a] -> b
_ [] = b
def
nonEmpty b
_ [a] -> b
f [a]
xs = [a] -> b
f [a]
xs
tmDispExprs :: TheoryModel -> [ModelExpr]
tmDispExprs :: TheoryModel -> [ModelExpr]
tmDispExprs TheoryModel
t = (ModelQDef -> ModelExpr) -> [ModelQDef] -> [ModelExpr]
forall a b. (a -> b) -> [a] -> [b]
map ModelQDef -> ModelExpr
forall c. Express c => c -> ModelExpr
express (TheoryModel
t TheoryModel
-> Getting [ModelQDef] TheoryModel [ModelQDef] -> [ModelQDef]
forall s a. s -> Getting a s a -> a
^. Getting [ModelQDef] TheoryModel [ModelQDef]
forall t. Theory t => Lens' t [ModelQDef]
Lens' TheoryModel [ModelQDef]
defined_quant) [ModelExpr] -> [ModelExpr] -> [ModelExpr]
forall a. [a] -> [a] -> [a]
++ TheoryModel
t TheoryModel
-> Getting [ModelExpr] TheoryModel [ModelExpr] -> [ModelExpr]
forall s a. s -> Getting a s a -> a
^. Getting [ModelExpr] TheoryModel [ModelExpr]
forall t. Theory t => Lens' t [ModelExpr]
Lens' TheoryModel [ModelExpr]
invariants
mkTMField :: TheoryModel -> SystemInformation -> Field -> ModRow -> ModRow
mkTMField :: TheoryModel
-> SystemInformation
-> Field
-> [(Identifier, [Contents])]
-> [(Identifier, [Contents])]
mkTMField TheoryModel
t SystemInformation
_ l :: Field
l@Field
Label [(Identifier, [Contents])]
fs = (Field -> Identifier
forall a. Show a => a -> Identifier
show Field
l, [Sentence -> Contents
mkParagraph (Sentence -> Contents) -> Sentence -> Contents
forall a b. (a -> b) -> a -> b
$ TheoryModel -> Sentence
forall n. NamedIdea n => n -> Sentence
atStart TheoryModel
t]) (Identifier, [Contents])
-> [(Identifier, [Contents])] -> [(Identifier, [Contents])]
forall a. a -> [a] -> [a]
: [(Identifier, [Contents])]
fs
mkTMField TheoryModel
t SystemInformation
_ l :: Field
l@Field
DefiningEquation [(Identifier, [Contents])]
fs = (Field -> Identifier
forall a. Show a => a -> Identifier
show Field
l, (ModelExpr -> Contents) -> [ModelExpr] -> [Contents]
forall a b. (a -> b) -> [a] -> [b]
map ModelExpr -> Contents
unlbldExpr ([ModelExpr] -> [Contents]) -> [ModelExpr] -> [Contents]
forall a b. (a -> b) -> a -> b
$ TheoryModel -> [ModelExpr]
tmDispExprs TheoryModel
t) (Identifier, [Contents])
-> [(Identifier, [Contents])] -> [(Identifier, [Contents])]
forall a. a -> [a] -> [a]
: [(Identifier, [Contents])]
fs
mkTMField TheoryModel
t SystemInformation
m l :: Field
l@(Description Verbosity
v InclUnits
u) [(Identifier, [Contents])]
fs = (Field -> Identifier
forall a. Show a => a -> Identifier
show Field
l,
(ModelExpr -> [Contents] -> [Contents])
-> [Contents] -> [ModelExpr] -> [Contents]
forall a b. (a -> b -> b) -> b -> [a] -> b
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr ((\ModelExpr
x -> Verbosity
-> InclUnits
-> ModelExpr
-> SystemInformation
-> [Contents]
-> [Contents]
buildDescription Verbosity
v InclUnits
u ModelExpr
x SystemInformation
m) (ModelExpr -> [Contents] -> [Contents])
-> (ModelExpr -> ModelExpr)
-> ModelExpr
-> [Contents]
-> [Contents]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ModelExpr -> ModelExpr
forall c. Express c => c -> ModelExpr
express) [] ([ModelExpr] -> [Contents]) -> [ModelExpr] -> [Contents]
forall a b. (a -> b) -> a -> b
$ TheoryModel -> [ModelExpr]
tmDispExprs TheoryModel
t) (Identifier, [Contents])
-> [(Identifier, [Contents])] -> [(Identifier, [Contents])]
forall a. a -> [a] -> [a]
: [(Identifier, [Contents])]
fs
mkTMField TheoryModel
t SystemInformation
m l :: Field
l@Field
RefBy [(Identifier, [Contents])]
fs = (Field -> Identifier
forall a. Show a => a -> Identifier
show Field
l, [Sentence -> Contents
mkParagraph (Sentence -> Contents) -> Sentence -> Contents
forall a b. (a -> b) -> a -> b
$ TheoryModel -> SystemInformation -> Sentence
forall t. HasUID t => t -> SystemInformation -> Sentence
helperRefs TheoryModel
t SystemInformation
m]) (Identifier, [Contents])
-> [(Identifier, [Contents])] -> [(Identifier, [Contents])]
forall a. a -> [a] -> [a]
: [(Identifier, [Contents])]
fs
mkTMField TheoryModel
t SystemInformation
_ l :: Field
l@Field
Source [(Identifier, [Contents])]
fs = (Field -> Identifier
forall a. Show a => a -> Identifier
show Field
l, [DecRef] -> [Contents]
helperSources ([DecRef] -> [Contents]) -> [DecRef] -> [Contents]
forall a b. (a -> b) -> a -> b
$ TheoryModel
t TheoryModel -> Getting [DecRef] TheoryModel [DecRef] -> [DecRef]
forall s a. s -> Getting a s a -> a
^. Getting [DecRef] TheoryModel [DecRef]
forall c. HasDecRef c => Lens' c [DecRef]
Lens' TheoryModel [DecRef]
getDecRefs) (Identifier, [Contents])
-> [(Identifier, [Contents])] -> [(Identifier, [Contents])]
forall a. a -> [a] -> [a]
: [(Identifier, [Contents])]
fs
mkTMField TheoryModel
t SystemInformation
_ l :: Field
l@Field
Notes [(Identifier, [Contents])]
fs =
[(Identifier, [Contents])]
-> ([Sentence] -> [(Identifier, [Contents])])
-> [Sentence]
-> [(Identifier, [Contents])]
forall b a. b -> ([a] -> b) -> [a] -> b
nonEmpty [(Identifier, [Contents])]
fs (\[Sentence]
ss -> (Field -> Identifier
forall a. Show a => a -> Identifier
show Field
l, (Sentence -> Contents) -> [Sentence] -> [Contents]
forall a b. (a -> b) -> [a] -> [b]
map Sentence -> Contents
mkParagraph [Sentence]
ss) (Identifier, [Contents])
-> [(Identifier, [Contents])] -> [(Identifier, [Contents])]
forall a. a -> [a] -> [a]
: [(Identifier, [Contents])]
fs) (TheoryModel
t TheoryModel
-> Getting [Sentence] TheoryModel [Sentence] -> [Sentence]
forall s a. s -> Getting a s a -> a
^. Getting [Sentence] TheoryModel [Sentence]
forall c. HasAdditionalNotes c => Lens' c [Sentence]
Lens' TheoryModel [Sentence]
getNotes)
mkTMField TheoryModel
_ SystemInformation
_ Field
l [(Identifier, [Contents])]
_ = Identifier -> [(Identifier, [Contents])]
forall a. HasCallStack => Identifier -> a
error (Identifier -> [(Identifier, [Contents])])
-> Identifier -> [(Identifier, [Contents])]
forall a b. (a -> b) -> a -> b
$ Identifier
"Label " Identifier -> Identifier -> Identifier
forall a. [a] -> [a] -> [a]
++ Field -> Identifier
forall a. Show a => a -> Identifier
show Field
l Identifier -> Identifier -> Identifier
forall a. [a] -> [a] -> [a]
++ Identifier
" not supported " Identifier -> Identifier -> Identifier
forall a. [a] -> [a] -> [a]
++
Identifier
"for theory models"
helperRefs :: HasUID t => t -> SystemInformation -> Sentence
helperRefs :: forall t. HasUID t => t -> SystemInformation -> Sentence
helperRefs t
t SystemInformation
s = SepType -> FoldType -> [Sentence] -> Sentence
foldlList SepType
Comma FoldType
List ([Sentence] -> Sentence) -> [Sentence] -> Sentence
forall a b. (a -> b) -> a -> b
$ (UID -> Sentence) -> [UID] -> [Sentence]
forall a b. (a -> b) -> [a] -> [b]
map (UID -> SystemInformation -> Sentence
`helpToRefField` SystemInformation
s) ([UID] -> [Sentence]) -> [UID] -> [Sentence]
forall a b. (a -> b) -> a -> b
$ [UID] -> [UID]
forall a. Eq a => [a] -> [a]
nub ([UID] -> [UID]) -> [UID] -> [UID]
forall a b. (a -> b) -> a -> b
$
UID -> RefbyMap -> [UID]
refbyLookup (t
t t -> Getting UID t UID -> UID
forall s a. s -> Getting a s a -> a
^. Getting UID t UID
forall c. HasUID c => Getter c UID
Getter t UID
uid) (SystemInformation -> ChunkDB
_sysinfodb SystemInformation
s ChunkDB -> Getting RefbyMap ChunkDB RefbyMap -> RefbyMap
forall s a. s -> Getting a s a -> a
^. Getting RefbyMap ChunkDB RefbyMap
Lens' ChunkDB RefbyMap
refbyTable)
helpToRefField :: UID -> SystemInformation -> Sentence
helpToRefField :: UID -> SystemInformation -> Sentence
helpToRefField UID
t SystemInformation
si
| Just Int
_ <- UID -> Map UID (DataDefinition, Int) -> Maybe Int
forall k a. Ord k => k -> Map k a -> Maybe Int
lookupIndex UID
t (ChunkDB
s ChunkDB
-> Getting
(Map UID (DataDefinition, Int))
ChunkDB
(Map UID (DataDefinition, Int))
-> Map UID (DataDefinition, Int)
forall s a. s -> Getting a s a -> a
^. Getting
(Map UID (DataDefinition, Int))
ChunkDB
(Map UID (DataDefinition, Int))
Lens' ChunkDB (Map UID (DataDefinition, Int))
dataDefnTable) = DataDefinition -> Sentence
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS (DataDefinition -> Sentence) -> DataDefinition -> Sentence
forall a b. (a -> b) -> a -> b
$ UID -> Map UID (DataDefinition, Int) -> DataDefinition
datadefnLookup UID
t (ChunkDB
s ChunkDB
-> Getting
(Map UID (DataDefinition, Int))
ChunkDB
(Map UID (DataDefinition, Int))
-> Map UID (DataDefinition, Int)
forall s a. s -> Getting a s a -> a
^. Getting
(Map UID (DataDefinition, Int))
ChunkDB
(Map UID (DataDefinition, Int))
Lens' ChunkDB (Map UID (DataDefinition, Int))
dataDefnTable)
| Just Int
_ <- UID -> Map UID (InstanceModel, Int) -> Maybe Int
forall k a. Ord k => k -> Map k a -> Maybe Int
lookupIndex UID
t (ChunkDB
s ChunkDB
-> Getting
(Map UID (InstanceModel, Int))
ChunkDB
(Map UID (InstanceModel, Int))
-> Map UID (InstanceModel, Int)
forall s a. s -> Getting a s a -> a
^. Getting
(Map UID (InstanceModel, Int))
ChunkDB
(Map UID (InstanceModel, Int))
Lens' ChunkDB (Map UID (InstanceModel, Int))
insmodelTable) = InstanceModel -> Sentence
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS (InstanceModel -> Sentence) -> InstanceModel -> Sentence
forall a b. (a -> b) -> a -> b
$ UID -> Map UID (InstanceModel, Int) -> InstanceModel
insmodelLookup UID
t (ChunkDB
s ChunkDB
-> Getting
(Map UID (InstanceModel, Int))
ChunkDB
(Map UID (InstanceModel, Int))
-> Map UID (InstanceModel, Int)
forall s a. s -> Getting a s a -> a
^. Getting
(Map UID (InstanceModel, Int))
ChunkDB
(Map UID (InstanceModel, Int))
Lens' ChunkDB (Map UID (InstanceModel, Int))
insmodelTable)
| Just Int
_ <- UID -> Map UID (GenDefn, Int) -> Maybe Int
forall k a. Ord k => k -> Map k a -> Maybe Int
lookupIndex UID
t (ChunkDB
s ChunkDB
-> Getting
(Map UID (GenDefn, Int)) ChunkDB (Map UID (GenDefn, Int))
-> Map UID (GenDefn, Int)
forall s a. s -> Getting a s a -> a
^. Getting (Map UID (GenDefn, Int)) ChunkDB (Map UID (GenDefn, Int))
Lens' ChunkDB (Map UID (GenDefn, Int))
gendefTable) = GenDefn -> Sentence
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS (GenDefn -> Sentence) -> GenDefn -> Sentence
forall a b. (a -> b) -> a -> b
$ UID -> Map UID (GenDefn, Int) -> GenDefn
gendefLookup UID
t (ChunkDB
s ChunkDB
-> Getting
(Map UID (GenDefn, Int)) ChunkDB (Map UID (GenDefn, Int))
-> Map UID (GenDefn, Int)
forall s a. s -> Getting a s a -> a
^. Getting (Map UID (GenDefn, Int)) ChunkDB (Map UID (GenDefn, Int))
Lens' ChunkDB (Map UID (GenDefn, Int))
gendefTable)
| Just Int
_ <- UID -> Map UID (TheoryModel, Int) -> Maybe Int
forall k a. Ord k => k -> Map k a -> Maybe Int
lookupIndex UID
t (ChunkDB
s ChunkDB
-> Getting
(Map UID (TheoryModel, Int)) ChunkDB (Map UID (TheoryModel, Int))
-> Map UID (TheoryModel, Int)
forall s a. s -> Getting a s a -> a
^. Getting
(Map UID (TheoryModel, Int)) ChunkDB (Map UID (TheoryModel, Int))
Lens' ChunkDB (Map UID (TheoryModel, Int))
theoryModelTable) = TheoryModel -> Sentence
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS (TheoryModel -> Sentence) -> TheoryModel -> Sentence
forall a b. (a -> b) -> a -> b
$ UID -> Map UID (TheoryModel, Int) -> TheoryModel
theoryModelLookup UID
t (ChunkDB
s ChunkDB
-> Getting
(Map UID (TheoryModel, Int)) ChunkDB (Map UID (TheoryModel, Int))
-> Map UID (TheoryModel, Int)
forall s a. s -> Getting a s a -> a
^. Getting
(Map UID (TheoryModel, Int)) ChunkDB (Map UID (TheoryModel, Int))
Lens' ChunkDB (Map UID (TheoryModel, Int))
theoryModelTable)
| Just Int
_ <- UID -> Map UID (ConceptInstance, Int) -> Maybe Int
forall k a. Ord k => k -> Map k a -> Maybe Int
lookupIndex UID
t (ChunkDB
s ChunkDB
-> Getting
(Map UID (ConceptInstance, Int))
ChunkDB
(Map UID (ConceptInstance, Int))
-> Map UID (ConceptInstance, Int)
forall s a. s -> Getting a s a -> a
^. Getting
(Map UID (ConceptInstance, Int))
ChunkDB
(Map UID (ConceptInstance, Int))
Lens' ChunkDB (Map UID (ConceptInstance, Int))
conceptinsTable) = ConceptInstance -> Sentence
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS (ConceptInstance -> Sentence) -> ConceptInstance -> Sentence
forall a b. (a -> b) -> a -> b
$ UID -> Map UID (ConceptInstance, Int) -> ConceptInstance
conceptinsLookup UID
t (ChunkDB
s ChunkDB
-> Getting
(Map UID (ConceptInstance, Int))
ChunkDB
(Map UID (ConceptInstance, Int))
-> Map UID (ConceptInstance, Int)
forall s a. s -> Getting a s a -> a
^. Getting
(Map UID (ConceptInstance, Int))
ChunkDB
(Map UID (ConceptInstance, Int))
Lens' ChunkDB (Map UID (ConceptInstance, Int))
conceptinsTable)
| Just Int
_ <- UID -> Map UID (Section, Int) -> Maybe Int
forall k a. Ord k => k -> Map k a -> Maybe Int
lookupIndex UID
t (ChunkDB
s ChunkDB
-> Getting
(Map UID (Section, Int)) ChunkDB (Map UID (Section, Int))
-> Map UID (Section, Int)
forall s a. s -> Getting a s a -> a
^. Getting (Map UID (Section, Int)) ChunkDB (Map UID (Section, Int))
Lens' ChunkDB (Map UID (Section, Int))
sectionTable) = Section -> Sentence
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS (Section -> Sentence) -> Section -> Sentence
forall a b. (a -> b) -> a -> b
$ UID -> Map UID (Section, Int) -> Section
sectionLookup UID
t (ChunkDB
s ChunkDB
-> Getting
(Map UID (Section, Int)) ChunkDB (Map UID (Section, Int))
-> Map UID (Section, Int)
forall s a. s -> Getting a s a -> a
^. Getting (Map UID (Section, Int)) ChunkDB (Map UID (Section, Int))
Lens' ChunkDB (Map UID (Section, Int))
sectionTable)
| Just Int
_ <- UID -> Map UID (LabelledContent, Int) -> Maybe Int
forall k a. Ord k => k -> Map k a -> Maybe Int
lookupIndex UID
t (ChunkDB
s ChunkDB
-> Getting
(Map UID (LabelledContent, Int))
ChunkDB
(Map UID (LabelledContent, Int))
-> Map UID (LabelledContent, Int)
forall s a. s -> Getting a s a -> a
^. Getting
(Map UID (LabelledContent, Int))
ChunkDB
(Map UID (LabelledContent, Int))
Lens' ChunkDB (Map UID (LabelledContent, Int))
labelledcontentTable) = LabelledContent -> Sentence
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS (LabelledContent -> Sentence) -> LabelledContent -> Sentence
forall a b. (a -> b) -> a -> b
$ UID -> Map UID (LabelledContent, Int) -> LabelledContent
labelledconLookup UID
t (ChunkDB
s ChunkDB
-> Getting
(Map UID (LabelledContent, Int))
ChunkDB
(Map UID (LabelledContent, Int))
-> Map UID (LabelledContent, Int)
forall s a. s -> Getting a s a -> a
^. Getting
(Map UID (LabelledContent, Int))
ChunkDB
(Map UID (LabelledContent, Int))
Lens' ChunkDB (Map UID (LabelledContent, Int))
labelledcontentTable)
| UID
t UID -> [UID] -> Bool
forall a. Eq a => a -> [a] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` (Citation -> UID) -> [Citation] -> [UID]
forall a b. (a -> b) -> [a] -> [b]
map (Citation -> Getting UID Citation UID -> UID
forall s a. s -> Getting a s a -> a
^. Getting UID Citation UID
forall c. HasUID c => Getter c UID
Getter Citation UID
uid) (SystemInformation -> [Citation]
citeDB SystemInformation
si) = Sentence
EmptyS
| Bool
otherwise = Identifier -> Sentence
forall a. HasCallStack => Identifier -> a
error (Identifier -> Sentence) -> Identifier -> Sentence
forall a b. (a -> b) -> a -> b
$ UID -> Identifier
forall a. Show a => a -> Identifier
show UID
t Identifier -> Identifier -> Identifier
forall a. [a] -> [a] -> [a]
++ Identifier
"Caught."
where s :: ChunkDB
s = SystemInformation -> ChunkDB
_sysinfodb SystemInformation
si
helperSources :: [DecRef] -> [Contents]
helperSources :: [DecRef] -> [Contents]
helperSources [] = [Sentence -> Contents
mkParagraph (Sentence -> Contents) -> Sentence -> Contents
forall a b. (a -> b) -> a -> b
$ Identifier -> Sentence
S Identifier
"--"]
helperSources [DecRef]
rs = [Sentence -> Contents
mkParagraph (Sentence -> Contents) -> Sentence -> Contents
forall a b. (a -> b) -> a -> b
$ SepType -> FoldType -> [Sentence] -> Sentence
foldlList SepType
Comma FoldType
List ([Sentence] -> Sentence) -> [Sentence] -> Sentence
forall a b. (a -> b) -> a -> b
$ (DecRef -> Sentence) -> [DecRef] -> [Sentence]
forall a b. (a -> b) -> [a] -> [b]
map (\DecRef
r -> UID -> Sentence -> RefInfo -> Sentence
Ref (DecRef
r DecRef -> Getting UID DecRef UID -> UID
forall s a. s -> Getting a s a -> a
^. Getting UID DecRef UID
forall c. HasUID c => Getter c UID
Getter DecRef UID
uid) Sentence
EmptyS (RefInfo -> Sentence) -> RefInfo -> Sentence
forall a b. (a -> b) -> a -> b
$ DecRef -> RefInfo
refInfo DecRef
r) [DecRef]
rs]
mkDDField :: DataDefinition -> SystemInformation -> Field -> ModRow -> ModRow
mkDDField :: DataDefinition
-> SystemInformation
-> Field
-> [(Identifier, [Contents])]
-> [(Identifier, [Contents])]
mkDDField DataDefinition
d SystemInformation
_ l :: Field
l@Field
Label [(Identifier, [Contents])]
fs = (Field -> Identifier
forall a. Show a => a -> Identifier
show Field
l, [Sentence -> Contents
mkParagraph (Sentence -> Contents) -> Sentence -> Contents
forall a b. (a -> b) -> a -> b
$ DataDefinition -> Sentence
forall n. NamedIdea n => n -> Sentence
atStart DataDefinition
d]) (Identifier, [Contents])
-> [(Identifier, [Contents])] -> [(Identifier, [Contents])]
forall a. a -> [a] -> [a]
: [(Identifier, [Contents])]
fs
mkDDField DataDefinition
d SystemInformation
_ l :: Field
l@Field
Symbol [(Identifier, [Contents])]
fs = (Field -> Identifier
forall a. Show a => a -> Identifier
show Field
l, [Sentence -> Contents
mkParagraph (Sentence -> Contents)
-> (Symbol -> Sentence) -> Symbol -> Contents
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Symbol -> Sentence
P (Symbol -> Contents) -> Symbol -> Contents
forall a b. (a -> b) -> a -> b
$ QuantityDict -> Symbol
forall q. HasSymbol q => q -> Symbol
eqSymb (QuantityDict -> Symbol) -> QuantityDict -> Symbol
forall a b. (a -> b) -> a -> b
$ DataDefinition
d DataDefinition
-> Getting QuantityDict DataDefinition QuantityDict -> QuantityDict
forall s a. s -> Getting a s a -> a
^. Getting QuantityDict DataDefinition QuantityDict
forall d. DefinesQuantity d => Getter d QuantityDict
Getter DataDefinition QuantityDict
defLhs]) (Identifier, [Contents])
-> [(Identifier, [Contents])] -> [(Identifier, [Contents])]
forall a. a -> [a] -> [a]
: [(Identifier, [Contents])]
fs
mkDDField DataDefinition
d SystemInformation
_ l :: Field
l@Field
Units [(Identifier, [Contents])]
fs = (Field -> Identifier
forall a. Show a => a -> Identifier
show Field
l, [Sentence -> Contents
mkParagraph (Sentence -> Contents) -> Sentence -> Contents
forall a b. (a -> b) -> a -> b
$ QuantityDict -> Sentence
forall u. MayHaveUnit u => u -> Sentence
toSentenceUnitless (QuantityDict -> Sentence) -> QuantityDict -> Sentence
forall a b. (a -> b) -> a -> b
$ DataDefinition
d DataDefinition
-> Getting QuantityDict DataDefinition QuantityDict -> QuantityDict
forall s a. s -> Getting a s a -> a
^. Getting QuantityDict DataDefinition QuantityDict
forall d. DefinesQuantity d => Getter d QuantityDict
Getter DataDefinition QuantityDict
defLhs]) (Identifier, [Contents])
-> [(Identifier, [Contents])] -> [(Identifier, [Contents])]
forall a. a -> [a] -> [a]
: [(Identifier, [Contents])]
fs
mkDDField DataDefinition
d SystemInformation
_ l :: Field
l@Field
DefiningEquation [(Identifier, [Contents])]
fs = (Field -> Identifier
forall a. Show a => a -> Identifier
show Field
l, [ModelExpr -> Contents
unlbldExpr (ModelExpr -> Contents) -> ModelExpr -> Contents
forall a b. (a -> b) -> a -> b
$ DataDefinition -> ModelExpr
forall c. Express c => c -> ModelExpr
express DataDefinition
d]) (Identifier, [Contents])
-> [(Identifier, [Contents])] -> [(Identifier, [Contents])]
forall a. a -> [a] -> [a]
: [(Identifier, [Contents])]
fs
mkDDField DataDefinition
d SystemInformation
m l :: Field
l@(Description Verbosity
v InclUnits
u) [(Identifier, [Contents])]
fs = (Field -> Identifier
forall a. Show a => a -> Identifier
show Field
l, Verbosity
-> InclUnits -> DataDefinition -> SystemInformation -> [Contents]
buildDDescription' Verbosity
v InclUnits
u DataDefinition
d SystemInformation
m) (Identifier, [Contents])
-> [(Identifier, [Contents])] -> [(Identifier, [Contents])]
forall a. a -> [a] -> [a]
: [(Identifier, [Contents])]
fs
mkDDField DataDefinition
t SystemInformation
m l :: Field
l@Field
RefBy [(Identifier, [Contents])]
fs = (Field -> Identifier
forall a. Show a => a -> Identifier
show Field
l, [Sentence -> Contents
mkParagraph (Sentence -> Contents) -> Sentence -> Contents
forall a b. (a -> b) -> a -> b
$ DataDefinition -> SystemInformation -> Sentence
forall t. HasUID t => t -> SystemInformation -> Sentence
helperRefs DataDefinition
t SystemInformation
m]) (Identifier, [Contents])
-> [(Identifier, [Contents])] -> [(Identifier, [Contents])]
forall a. a -> [a] -> [a]
: [(Identifier, [Contents])]
fs
mkDDField DataDefinition
d SystemInformation
_ l :: Field
l@Field
Source [(Identifier, [Contents])]
fs = (Field -> Identifier
forall a. Show a => a -> Identifier
show Field
l, [DecRef] -> [Contents]
helperSources ([DecRef] -> [Contents]) -> [DecRef] -> [Contents]
forall a b. (a -> b) -> a -> b
$ DataDefinition
d DataDefinition
-> Getting [DecRef] DataDefinition [DecRef] -> [DecRef]
forall s a. s -> Getting a s a -> a
^. Getting [DecRef] DataDefinition [DecRef]
forall c. HasDecRef c => Lens' c [DecRef]
Lens' DataDefinition [DecRef]
getDecRefs) (Identifier, [Contents])
-> [(Identifier, [Contents])] -> [(Identifier, [Contents])]
forall a. a -> [a] -> [a]
: [(Identifier, [Contents])]
fs
mkDDField DataDefinition
d SystemInformation
_ l :: Field
l@Field
Notes [(Identifier, [Contents])]
fs = [(Identifier, [Contents])]
-> ([Sentence] -> [(Identifier, [Contents])])
-> [Sentence]
-> [(Identifier, [Contents])]
forall b a. b -> ([a] -> b) -> [a] -> b
nonEmpty [(Identifier, [Contents])]
fs (\[Sentence]
ss -> (Field -> Identifier
forall a. Show a => a -> Identifier
show Field
l, (Sentence -> Contents) -> [Sentence] -> [Contents]
forall a b. (a -> b) -> [a] -> [b]
map Sentence -> Contents
mkParagraph [Sentence]
ss) (Identifier, [Contents])
-> [(Identifier, [Contents])] -> [(Identifier, [Contents])]
forall a. a -> [a] -> [a]
: [(Identifier, [Contents])]
fs) (DataDefinition
d DataDefinition
-> Getting [Sentence] DataDefinition [Sentence] -> [Sentence]
forall s a. s -> Getting a s a -> a
^. Getting [Sentence] DataDefinition [Sentence]
forall c. HasAdditionalNotes c => Lens' c [Sentence]
Lens' DataDefinition [Sentence]
getNotes)
mkDDField DataDefinition
_ SystemInformation
_ Field
l [(Identifier, [Contents])]
_ = Identifier -> [(Identifier, [Contents])]
forall a. HasCallStack => Identifier -> a
error (Identifier -> [(Identifier, [Contents])])
-> Identifier -> [(Identifier, [Contents])]
forall a b. (a -> b) -> a -> b
$ Identifier
"Label " Identifier -> Identifier -> Identifier
forall a. [a] -> [a] -> [a]
++ Field -> Identifier
forall a. Show a => a -> Identifier
show Field
l Identifier -> Identifier -> Identifier
forall a. [a] -> [a] -> [a]
++ Identifier
" not supported " Identifier -> Identifier -> Identifier
forall a. [a] -> [a] -> [a]
++
Identifier
"for data definitions"
buildDescription :: Verbosity -> InclUnits -> ModelExpr -> SystemInformation -> [Contents] ->
[Contents]
buildDescription :: Verbosity
-> InclUnits
-> ModelExpr
-> SystemInformation
-> [Contents]
-> [Contents]
buildDescription Verbosity
Succinct InclUnits
_ ModelExpr
_ SystemInformation
_ [Contents]
_ = []
buildDescription Verbosity
Verbose InclUnits
u ModelExpr
e SystemInformation
m [Contents]
cs = (UnlabelledContent -> Contents
UlC (UnlabelledContent -> Contents)
-> ([QuantityDict] -> UnlabelledContent)
-> [QuantityDict]
-> Contents
forall b c a. (b -> c) -> (a -> b) -> a -> c
. RawContent -> UnlabelledContent
ulcc (RawContent -> UnlabelledContent)
-> ([QuantityDict] -> RawContent)
-> [QuantityDict]
-> UnlabelledContent
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
ListType -> RawContent
Enumeration (ListType -> RawContent)
-> ([QuantityDict] -> ListType) -> [QuantityDict] -> RawContent
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [ListTuple] -> ListType
Definitions ([ListTuple] -> ListType)
-> ([QuantityDict] -> [ListTuple]) -> [QuantityDict] -> ListType
forall b c a. (b -> c) -> (a -> b) -> a -> c
. InclUnits -> [QuantityDict] -> [ListTuple]
forall q.
(Quantity q, MayHaveUnit q) =>
InclUnits -> [q] -> [ListTuple]
descPairs InclUnits
u ([QuantityDict] -> Contents) -> [QuantityDict] -> Contents
forall a b. (a -> b) -> a -> b
$ ModelExpr -> ChunkDB -> [QuantityDict]
vars ModelExpr
e (ChunkDB -> [QuantityDict]) -> ChunkDB -> [QuantityDict]
forall a b. (a -> b) -> a -> b
$ SystemInformation -> ChunkDB
_sysinfodb SystemInformation
m) Contents -> [Contents] -> [Contents]
forall a. a -> [a] -> [a]
: [Contents]
cs
buildDDescription' :: Verbosity -> InclUnits -> DataDefinition -> SystemInformation ->
[Contents]
buildDDescription' :: Verbosity
-> InclUnits -> DataDefinition -> SystemInformation -> [Contents]
buildDDescription' Verbosity
Succinct InclUnits
u DataDefinition
d SystemInformation
_ = [UnlabelledContent -> Contents
UlC (UnlabelledContent -> Contents)
-> (ListType -> UnlabelledContent) -> ListType -> Contents
forall b c a. (b -> c) -> (a -> b) -> a -> c
. RawContent -> UnlabelledContent
ulcc (RawContent -> UnlabelledContent)
-> (ListType -> RawContent) -> ListType -> UnlabelledContent
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ListType -> RawContent
Enumeration (ListType -> Contents) -> ListType -> Contents
forall a b. (a -> b) -> a -> b
$ [ListTuple] -> ListType
Definitions [InclUnits -> DataDefinition -> ListTuple
firstPair' InclUnits
u DataDefinition
d]]
buildDDescription' Verbosity
Verbose InclUnits
u DataDefinition
d SystemInformation
m = [UnlabelledContent -> Contents
UlC (UnlabelledContent -> Contents)
-> (ListType -> UnlabelledContent) -> ListType -> Contents
forall b c a. (b -> c) -> (a -> b) -> a -> c
. RawContent -> UnlabelledContent
ulcc (RawContent -> UnlabelledContent)
-> (ListType -> RawContent) -> ListType -> UnlabelledContent
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ListType -> RawContent
Enumeration (ListType -> Contents) -> ListType -> Contents
forall a b. (a -> b) -> a -> b
$ [ListTuple] -> ListType
Definitions ([ListTuple] -> ListType) -> [ListTuple] -> ListType
forall a b. (a -> b) -> a -> b
$
InclUnits -> DataDefinition -> ListTuple
firstPair' InclUnits
u DataDefinition
d ListTuple -> [ListTuple] -> [ListTuple]
forall a. a -> [a] -> [a]
: InclUnits -> [QuantityDict] -> [ListTuple]
forall q.
(Quantity q, MayHaveUnit q) =>
InclUnits -> [q] -> [ListTuple]
descPairs InclUnits
u ((ModelExpr -> ChunkDB -> [QuantityDict])
-> ChunkDB -> ModelExpr -> [QuantityDict]
forall a b c. (a -> b -> c) -> b -> a -> c
flip ModelExpr -> ChunkDB -> [QuantityDict]
vars (SystemInformation -> ChunkDB
_sysinfodb SystemInformation
m) (ModelExpr -> [QuantityDict]) -> ModelExpr -> [QuantityDict]
forall a b. (a -> b) -> a -> b
$
(QDefinition Expr -> ModelExpr)
-> (ModelQDef -> ModelExpr)
-> Either (QDefinition Expr) ModelQDef
-> ModelExpr
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either (Expr -> ModelExpr
forall c. Express c => c -> ModelExpr
express (Expr -> ModelExpr)
-> (QDefinition Expr -> Expr) -> QDefinition Expr -> ModelExpr
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (QDefinition Expr -> Getting Expr (QDefinition Expr) Expr -> Expr
forall s a. s -> Getting a s a -> a
^. Getting Expr (QDefinition Expr) Expr
forall e. Lens' (QDefinition e) e
forall (c :: * -> *) e. DefiningExpr c => Lens' (c e) e
defnExpr)) (ModelQDef -> Getting ModelExpr ModelQDef ModelExpr -> ModelExpr
forall s a. s -> Getting a s a -> a
^. Getting ModelExpr ModelQDef ModelExpr
forall e. Lens' (QDefinition e) e
forall (c :: * -> *) e. DefiningExpr c => Lens' (c e) e
defnExpr) (DataDefinition -> Either (QDefinition Expr) ModelQDef
qdFromDD DataDefinition
d))]
mkGDField :: GenDefn -> SystemInformation -> Field -> ModRow -> ModRow
mkGDField :: GenDefn
-> SystemInformation
-> Field
-> [(Identifier, [Contents])]
-> [(Identifier, [Contents])]
mkGDField GenDefn
g SystemInformation
_ l :: Field
l@Field
Label [(Identifier, [Contents])]
fs = (Field -> Identifier
forall a. Show a => a -> Identifier
show Field
l, [Sentence -> Contents
mkParagraph (Sentence -> Contents) -> Sentence -> Contents
forall a b. (a -> b) -> a -> b
$ GenDefn -> Sentence
forall n. NamedIdea n => n -> Sentence
atStart GenDefn
g]) (Identifier, [Contents])
-> [(Identifier, [Contents])] -> [(Identifier, [Contents])]
forall a. a -> [a] -> [a]
: [(Identifier, [Contents])]
fs
mkGDField GenDefn
g SystemInformation
_ l :: Field
l@Field
Units [(Identifier, [Contents])]
fs =
[(Identifier, [Contents])]
-> (UnitDefn -> [(Identifier, [Contents])])
-> Maybe UnitDefn
-> [(Identifier, [Contents])]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [(Identifier, [Contents])]
fs (\UnitDefn
udef -> (Field -> Identifier
forall a. Show a => a -> Identifier
show Field
l, [Sentence -> Contents
mkParagraph (Sentence -> Contents) -> (USymb -> Sentence) -> USymb -> Contents
forall b c a. (b -> c) -> (a -> b) -> a -> c
. USymb -> Sentence
Sy (USymb -> Contents) -> USymb -> Contents
forall a b. (a -> b) -> a -> b
$ UnitDefn -> USymb
forall u. HasUnitSymbol u => u -> USymb
usymb UnitDefn
udef]) (Identifier, [Contents])
-> [(Identifier, [Contents])] -> [(Identifier, [Contents])]
forall a. a -> [a] -> [a]
: [(Identifier, [Contents])]
fs) (GenDefn -> Maybe UnitDefn
forall u. MayHaveUnit u => u -> Maybe UnitDefn
getUnit GenDefn
g)
mkGDField GenDefn
g SystemInformation
_ l :: Field
l@Field
DefiningEquation [(Identifier, [Contents])]
fs = (Field -> Identifier
forall a. Show a => a -> Identifier
show Field
l, [ModelExpr -> Contents
unlbldExpr (ModelExpr -> Contents) -> ModelExpr -> Contents
forall a b. (a -> b) -> a -> b
$ GenDefn -> ModelExpr
forall c. Express c => c -> ModelExpr
express GenDefn
g]) (Identifier, [Contents])
-> [(Identifier, [Contents])] -> [(Identifier, [Contents])]
forall a. a -> [a] -> [a]
: [(Identifier, [Contents])]
fs
mkGDField GenDefn
g SystemInformation
m l :: Field
l@(Description Verbosity
v InclUnits
u) [(Identifier, [Contents])]
fs = (Field -> Identifier
forall a. Show a => a -> Identifier
show Field
l,
Verbosity
-> InclUnits
-> ModelExpr
-> SystemInformation
-> [Contents]
-> [Contents]
buildDescription Verbosity
v InclUnits
u (GenDefn -> ModelExpr
forall c. Express c => c -> ModelExpr
express GenDefn
g) SystemInformation
m []) (Identifier, [Contents])
-> [(Identifier, [Contents])] -> [(Identifier, [Contents])]
forall a. a -> [a] -> [a]
: [(Identifier, [Contents])]
fs
mkGDField GenDefn
g SystemInformation
m l :: Field
l@Field
RefBy [(Identifier, [Contents])]
fs = (Field -> Identifier
forall a. Show a => a -> Identifier
show Field
l, [Sentence -> Contents
mkParagraph (Sentence -> Contents) -> Sentence -> Contents
forall a b. (a -> b) -> a -> b
$ GenDefn -> SystemInformation -> Sentence
forall t. HasUID t => t -> SystemInformation -> Sentence
helperRefs GenDefn
g SystemInformation
m]) (Identifier, [Contents])
-> [(Identifier, [Contents])] -> [(Identifier, [Contents])]
forall a. a -> [a] -> [a]
: [(Identifier, [Contents])]
fs
mkGDField GenDefn
g SystemInformation
_ l :: Field
l@Field
Source [(Identifier, [Contents])]
fs = (Field -> Identifier
forall a. Show a => a -> Identifier
show Field
l, [DecRef] -> [Contents]
helperSources ([DecRef] -> [Contents]) -> [DecRef] -> [Contents]
forall a b. (a -> b) -> a -> b
$ GenDefn
g GenDefn -> Getting [DecRef] GenDefn [DecRef] -> [DecRef]
forall s a. s -> Getting a s a -> a
^. Getting [DecRef] GenDefn [DecRef]
forall c. HasDecRef c => Lens' c [DecRef]
Lens' GenDefn [DecRef]
getDecRefs) (Identifier, [Contents])
-> [(Identifier, [Contents])] -> [(Identifier, [Contents])]
forall a. a -> [a] -> [a]
: [(Identifier, [Contents])]
fs
mkGDField GenDefn
g SystemInformation
_ l :: Field
l@Field
Notes [(Identifier, [Contents])]
fs = [(Identifier, [Contents])]
-> ([Sentence] -> [(Identifier, [Contents])])
-> [Sentence]
-> [(Identifier, [Contents])]
forall b a. b -> ([a] -> b) -> [a] -> b
nonEmpty [(Identifier, [Contents])]
fs (\[Sentence]
ss -> (Field -> Identifier
forall a. Show a => a -> Identifier
show Field
l, (Sentence -> Contents) -> [Sentence] -> [Contents]
forall a b. (a -> b) -> [a] -> [b]
map Sentence -> Contents
mkParagraph [Sentence]
ss) (Identifier, [Contents])
-> [(Identifier, [Contents])] -> [(Identifier, [Contents])]
forall a. a -> [a] -> [a]
: [(Identifier, [Contents])]
fs) (GenDefn
g GenDefn -> Getting [Sentence] GenDefn [Sentence] -> [Sentence]
forall s a. s -> Getting a s a -> a
^. Getting [Sentence] GenDefn [Sentence]
forall c. HasAdditionalNotes c => Lens' c [Sentence]
Lens' GenDefn [Sentence]
getNotes)
mkGDField GenDefn
_ SystemInformation
_ Field
l [(Identifier, [Contents])]
_ = Identifier -> [(Identifier, [Contents])]
forall a. HasCallStack => Identifier -> a
error (Identifier -> [(Identifier, [Contents])])
-> Identifier -> [(Identifier, [Contents])]
forall a b. (a -> b) -> a -> b
$ Identifier
"Label " Identifier -> Identifier -> Identifier
forall a. [a] -> [a] -> [a]
++ Field -> Identifier
forall a. Show a => a -> Identifier
show Field
l Identifier -> Identifier -> Identifier
forall a. [a] -> [a] -> [a]
++ Identifier
" not supported for gen defs"
mkIMField :: InstanceModel -> SystemInformation -> Field -> ModRow -> ModRow
mkIMField :: InstanceModel
-> SystemInformation
-> Field
-> [(Identifier, [Contents])]
-> [(Identifier, [Contents])]
mkIMField InstanceModel
i SystemInformation
_ l :: Field
l@Field
Label [(Identifier, [Contents])]
fs = (Field -> Identifier
forall a. Show a => a -> Identifier
show Field
l, [Sentence -> Contents
mkParagraph (Sentence -> Contents) -> Sentence -> Contents
forall a b. (a -> b) -> a -> b
$ InstanceModel -> Sentence
forall n. NamedIdea n => n -> Sentence
atStart InstanceModel
i]) (Identifier, [Contents])
-> [(Identifier, [Contents])] -> [(Identifier, [Contents])]
forall a. a -> [a] -> [a]
: [(Identifier, [Contents])]
fs
mkIMField InstanceModel
i SystemInformation
_ l :: Field
l@Field
DefiningEquation [(Identifier, [Contents])]
fs = (Field -> Identifier
forall a. Show a => a -> Identifier
show Field
l, [ModelExpr -> Contents
unlbldExpr (ModelExpr -> Contents) -> ModelExpr -> Contents
forall a b. (a -> b) -> a -> b
$ InstanceModel -> ModelExpr
forall c. Express c => c -> ModelExpr
express InstanceModel
i]) (Identifier, [Contents])
-> [(Identifier, [Contents])] -> [(Identifier, [Contents])]
forall a. a -> [a] -> [a]
: [(Identifier, [Contents])]
fs
mkIMField InstanceModel
i SystemInformation
m l :: Field
l@(Description Verbosity
v InclUnits
u) [(Identifier, [Contents])]
fs = (Field -> Identifier
forall a. Show a => a -> Identifier
show Field
l,
(ModelExpr -> [Contents] -> [Contents])
-> [Contents] -> [ModelExpr] -> [Contents]
forall a b. (a -> b -> b) -> b -> [a] -> b
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr (\ModelExpr
x -> Verbosity
-> InclUnits
-> ModelExpr
-> SystemInformation
-> [Contents]
-> [Contents]
buildDescription Verbosity
v InclUnits
u ModelExpr
x SystemInformation
m) [] [InstanceModel -> ModelExpr
forall c. Express c => c -> ModelExpr
express InstanceModel
i]) (Identifier, [Contents])
-> [(Identifier, [Contents])] -> [(Identifier, [Contents])]
forall a. a -> [a] -> [a]
: [(Identifier, [Contents])]
fs
mkIMField InstanceModel
i SystemInformation
m l :: Field
l@Field
RefBy [(Identifier, [Contents])]
fs = (Field -> Identifier
forall a. Show a => a -> Identifier
show Field
l, [Sentence -> Contents
mkParagraph (Sentence -> Contents) -> Sentence -> Contents
forall a b. (a -> b) -> a -> b
$ InstanceModel -> SystemInformation -> Sentence
forall t. HasUID t => t -> SystemInformation -> Sentence
helperRefs InstanceModel
i SystemInformation
m]) (Identifier, [Contents])
-> [(Identifier, [Contents])] -> [(Identifier, [Contents])]
forall a. a -> [a] -> [a]
: [(Identifier, [Contents])]
fs
mkIMField InstanceModel
i SystemInformation
_ l :: Field
l@Field
Source [(Identifier, [Contents])]
fs = (Field -> Identifier
forall a. Show a => a -> Identifier
show Field
l, [DecRef] -> [Contents]
helperSources ([DecRef] -> [Contents]) -> [DecRef] -> [Contents]
forall a b. (a -> b) -> a -> b
$ InstanceModel
i InstanceModel
-> Getting [DecRef] InstanceModel [DecRef] -> [DecRef]
forall s a. s -> Getting a s a -> a
^. Getting [DecRef] InstanceModel [DecRef]
forall c. HasDecRef c => Lens' c [DecRef]
Lens' InstanceModel [DecRef]
getDecRefs) (Identifier, [Contents])
-> [(Identifier, [Contents])] -> [(Identifier, [Contents])]
forall a. a -> [a] -> [a]
: [(Identifier, [Contents])]
fs
mkIMField InstanceModel
i SystemInformation
_ l :: Field
l@Field
Output [(Identifier, [Contents])]
fs = (Field -> Identifier
forall a. Show a => a -> Identifier
show Field
l, [Sentence -> Contents
mkParagraph Sentence
x]) (Identifier, [Contents])
-> [(Identifier, [Contents])] -> [(Identifier, [Contents])]
forall a. a -> [a] -> [a]
: [(Identifier, [Contents])]
fs
where x :: Sentence
x = Symbol -> Sentence
P (Symbol -> Sentence)
-> (QuantityDict -> Symbol) -> QuantityDict -> Sentence
forall b c a. (b -> c) -> (a -> b) -> a -> c
. QuantityDict -> Symbol
forall q. HasSymbol q => q -> Symbol
eqSymb (QuantityDict -> Sentence) -> QuantityDict -> Sentence
forall a b. (a -> b) -> a -> b
$ InstanceModel
i InstanceModel
-> Getting QuantityDict InstanceModel QuantityDict -> QuantityDict
forall s a. s -> Getting a s a -> a
^. Getting QuantityDict InstanceModel QuantityDict
forall c. HasOutput c => Getter c QuantityDict
Getter InstanceModel QuantityDict
output
mkIMField InstanceModel
i SystemInformation
_ l :: Field
l@Field
Input [(Identifier, [Contents])]
fs =
case ((QuantityDict, Maybe (RealInterval Expr Expr)) -> QuantityDict)
-> [(QuantityDict, Maybe (RealInterval Expr Expr))]
-> [QuantityDict]
forall a b. (a -> b) -> [a] -> [b]
map (QuantityDict, Maybe (RealInterval Expr Expr)) -> QuantityDict
forall a b. (a, b) -> a
fst (InstanceModel
i InstanceModel
-> Getting
[(QuantityDict, Maybe (RealInterval Expr Expr))]
InstanceModel
[(QuantityDict, Maybe (RealInterval Expr Expr))]
-> [(QuantityDict, Maybe (RealInterval Expr Expr))]
forall s a. s -> Getting a s a -> a
^. Getting
[(QuantityDict, Maybe (RealInterval Expr Expr))]
InstanceModel
[(QuantityDict, Maybe (RealInterval Expr Expr))]
forall c.
HasInputs c =>
Lens' c [(QuantityDict, Maybe (RealInterval Expr Expr))]
Lens'
InstanceModel [(QuantityDict, Maybe (RealInterval Expr Expr))]
inputs) of
[] -> (Field -> Identifier
forall a. Show a => a -> Identifier
show Field
l, [Sentence -> Contents
mkParagraph Sentence
EmptyS]) (Identifier, [Contents])
-> [(Identifier, [Contents])] -> [(Identifier, [Contents])]
forall a. a -> [a] -> [a]
: [(Identifier, [Contents])]
fs
(QuantityDict
_:[QuantityDict]
_) -> (Field -> Identifier
forall a. Show a => a -> Identifier
show Field
l, [Sentence -> Contents
mkParagraph (Sentence -> Contents) -> Sentence -> Contents
forall a b. (a -> b) -> a -> b
$ (Sentence -> Sentence -> Sentence) -> [Sentence] -> Sentence
forall a. (a -> a -> a) -> [a] -> a
forall (t :: * -> *) a. Foldable t => (a -> a -> a) -> t a -> a
foldl1 Sentence -> Sentence -> Sentence
sC [Sentence]
xs]) (Identifier, [Contents])
-> [(Identifier, [Contents])] -> [(Identifier, [Contents])]
forall a. a -> [a] -> [a]
: [(Identifier, [Contents])]
fs
where xs :: [Sentence]
xs = ((QuantityDict, Maybe (RealInterval Expr Expr)) -> Sentence)
-> [(QuantityDict, Maybe (RealInterval Expr Expr))] -> [Sentence]
forall a b. (a -> b) -> [a] -> [b]
map (Symbol -> Sentence
P (Symbol -> Sentence)
-> ((QuantityDict, Maybe (RealInterval Expr Expr)) -> Symbol)
-> (QuantityDict, Maybe (RealInterval Expr Expr))
-> Sentence
forall b c a. (b -> c) -> (a -> b) -> a -> c
. QuantityDict -> Symbol
forall q. HasSymbol q => q -> Symbol
eqSymb (QuantityDict -> Symbol)
-> ((QuantityDict, Maybe (RealInterval Expr Expr)) -> QuantityDict)
-> (QuantityDict, Maybe (RealInterval Expr Expr))
-> Symbol
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (QuantityDict, Maybe (RealInterval Expr Expr)) -> QuantityDict
forall a b. (a, b) -> a
fst) ([(QuantityDict, Maybe (RealInterval Expr Expr))] -> [Sentence])
-> [(QuantityDict, Maybe (RealInterval Expr Expr))] -> [Sentence]
forall a b. (a -> b) -> a -> b
$ InstanceModel
i InstanceModel
-> Getting
[(QuantityDict, Maybe (RealInterval Expr Expr))]
InstanceModel
[(QuantityDict, Maybe (RealInterval Expr Expr))]
-> [(QuantityDict, Maybe (RealInterval Expr Expr))]
forall s a. s -> Getting a s a -> a
^. Getting
[(QuantityDict, Maybe (RealInterval Expr Expr))]
InstanceModel
[(QuantityDict, Maybe (RealInterval Expr Expr))]
forall c.
HasInputs c =>
Lens' c [(QuantityDict, Maybe (RealInterval Expr Expr))]
Lens'
InstanceModel [(QuantityDict, Maybe (RealInterval Expr Expr))]
inputs
mkIMField InstanceModel
i SystemInformation
_ l :: Field
l@Field
InConstraints [(Identifier, [Contents])]
fs =
let ll :: [(QuantityDict, RealInterval Expr Expr)]
ll = ((QuantityDict, Maybe (RealInterval Expr Expr))
-> Maybe (QuantityDict, RealInterval Expr Expr))
-> [(QuantityDict, Maybe (RealInterval Expr Expr))]
-> [(QuantityDict, RealInterval Expr Expr)]
forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe (\(QuantityDict
x,Maybe (RealInterval Expr Expr)
y) -> Maybe (RealInterval Expr Expr)
y Maybe (RealInterval Expr Expr)
-> (RealInterval Expr Expr
-> Maybe (QuantityDict, RealInterval Expr Expr))
-> Maybe (QuantityDict, RealInterval Expr Expr)
forall a b. Maybe a -> (a -> Maybe b) -> Maybe b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (\RealInterval Expr Expr
z -> (QuantityDict, RealInterval Expr Expr)
-> Maybe (QuantityDict, RealInterval Expr Expr)
forall a. a -> Maybe a
Just (QuantityDict
x, RealInterval Expr Expr
z))) (InstanceModel
i InstanceModel
-> Getting
[(QuantityDict, Maybe (RealInterval Expr Expr))]
InstanceModel
[(QuantityDict, Maybe (RealInterval Expr Expr))]
-> [(QuantityDict, Maybe (RealInterval Expr Expr))]
forall s a. s -> Getting a s a -> a
^. Getting
[(QuantityDict, Maybe (RealInterval Expr Expr))]
InstanceModel
[(QuantityDict, Maybe (RealInterval Expr Expr))]
forall c.
HasInputs c =>
Lens' c [(QuantityDict, Maybe (RealInterval Expr Expr))]
Lens'
InstanceModel [(QuantityDict, Maybe (RealInterval Expr Expr))]
inputs) in
(Field -> Identifier
forall a. Show a => a -> Identifier
show Field
l, ((QuantityDict, RealInterval Expr Expr)
-> [Contents] -> [Contents])
-> [Contents]
-> [(QuantityDict, RealInterval Expr Expr)]
-> [Contents]
forall a b. (a -> b -> b) -> b -> [a] -> b
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr ((:) (Contents -> [Contents] -> [Contents])
-> ((QuantityDict, RealInterval Expr Expr) -> Contents)
-> (QuantityDict, RealInterval Expr Expr)
-> [Contents]
-> [Contents]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. UnlabelledContent -> Contents
UlC (UnlabelledContent -> Contents)
-> ((QuantityDict, RealInterval Expr Expr) -> UnlabelledContent)
-> (QuantityDict, RealInterval Expr Expr)
-> Contents
forall b c a. (b -> c) -> (a -> b) -> a -> c
. RawContent -> UnlabelledContent
ulcc (RawContent -> UnlabelledContent)
-> ((QuantityDict, RealInterval Expr Expr) -> RawContent)
-> (QuantityDict, RealInterval Expr Expr)
-> UnlabelledContent
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ModelExpr -> RawContent
EqnBlock (ModelExpr -> RawContent)
-> ((QuantityDict, RealInterval Expr Expr) -> ModelExpr)
-> (QuantityDict, RealInterval Expr Expr)
-> RawContent
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Expr -> ModelExpr
forall c. Express c => c -> ModelExpr
express (Expr -> ModelExpr)
-> ((QuantityDict, RealInterval Expr Expr) -> Expr)
-> (QuantityDict, RealInterval Expr Expr)
-> ModelExpr
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (QuantityDict -> RealInterval Expr Expr -> Expr)
-> (QuantityDict, RealInterval Expr Expr) -> Expr
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry QuantityDict -> RealInterval Expr Expr -> Expr
forall c. HasUID c => c -> RealInterval Expr Expr -> Expr
forall r c. (ExprC r, HasUID c) => c -> RealInterval r r -> r
realInterval) [] [(QuantityDict, RealInterval Expr Expr)]
ll) (Identifier, [Contents])
-> [(Identifier, [Contents])] -> [(Identifier, [Contents])]
forall a. a -> [a] -> [a]
: [(Identifier, [Contents])]
fs
mkIMField InstanceModel
i SystemInformation
_ l :: Field
l@Field
OutConstraints [(Identifier, [Contents])]
fs =
(Field -> Identifier
forall a. Show a => a -> Identifier
show Field
l, (RealInterval Expr Expr -> [Contents] -> [Contents])
-> [Contents] -> [RealInterval Expr Expr] -> [Contents]
forall a b. (a -> b -> b) -> b -> [a] -> b
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr ((:) (Contents -> [Contents] -> [Contents])
-> (RealInterval Expr Expr -> Contents)
-> RealInterval Expr Expr
-> [Contents]
-> [Contents]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. UnlabelledContent -> Contents
UlC (UnlabelledContent -> Contents)
-> (RealInterval Expr Expr -> UnlabelledContent)
-> RealInterval Expr Expr
-> Contents
forall b c a. (b -> c) -> (a -> b) -> a -> c
. RawContent -> UnlabelledContent
ulcc (RawContent -> UnlabelledContent)
-> (RealInterval Expr Expr -> RawContent)
-> RealInterval Expr Expr
-> UnlabelledContent
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ModelExpr -> RawContent
EqnBlock (ModelExpr -> RawContent)
-> (RealInterval Expr Expr -> ModelExpr)
-> RealInterval Expr Expr
-> RawContent
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Expr -> ModelExpr
forall c. Express c => c -> ModelExpr
express (Expr -> ModelExpr)
-> (RealInterval Expr Expr -> Expr)
-> RealInterval Expr Expr
-> ModelExpr
forall b c a. (b -> c) -> (a -> b) -> a -> c
. QuantityDict -> RealInterval Expr Expr -> Expr
forall c. HasUID c => c -> RealInterval Expr Expr -> Expr
forall r c. (ExprC r, HasUID c) => c -> RealInterval r r -> r
realInterval (InstanceModel
i InstanceModel
-> Getting QuantityDict InstanceModel QuantityDict -> QuantityDict
forall s a. s -> Getting a s a -> a
^. Getting QuantityDict InstanceModel QuantityDict
forall c. HasOutput c => Getter c QuantityDict
Getter InstanceModel QuantityDict
output)) []
(InstanceModel
i InstanceModel
-> Getting
[RealInterval Expr Expr] InstanceModel [RealInterval Expr Expr]
-> [RealInterval Expr Expr]
forall s a. s -> Getting a s a -> a
^. Getting
[RealInterval Expr Expr] InstanceModel [RealInterval Expr Expr]
forall c. HasOutput c => Getter c [RealInterval Expr Expr]
Getter InstanceModel [RealInterval Expr Expr]
out_constraints)) (Identifier, [Contents])
-> [(Identifier, [Contents])] -> [(Identifier, [Contents])]
forall a. a -> [a] -> [a]
: [(Identifier, [Contents])]
fs
mkIMField InstanceModel
i SystemInformation
_ l :: Field
l@Field
Notes [(Identifier, [Contents])]
fs =
[(Identifier, [Contents])]
-> ([Sentence] -> [(Identifier, [Contents])])
-> [Sentence]
-> [(Identifier, [Contents])]
forall b a. b -> ([a] -> b) -> [a] -> b
nonEmpty [(Identifier, [Contents])]
fs (\[Sentence]
ss -> (Field -> Identifier
forall a. Show a => a -> Identifier
show Field
l, (Sentence -> Contents) -> [Sentence] -> [Contents]
forall a b. (a -> b) -> [a] -> [b]
map Sentence -> Contents
mkParagraph [Sentence]
ss) (Identifier, [Contents])
-> [(Identifier, [Contents])] -> [(Identifier, [Contents])]
forall a. a -> [a] -> [a]
: [(Identifier, [Contents])]
fs) (InstanceModel
i InstanceModel
-> Getting [Sentence] InstanceModel [Sentence] -> [Sentence]
forall s a. s -> Getting a s a -> a
^. Getting [Sentence] InstanceModel [Sentence]
forall c. HasAdditionalNotes c => Lens' c [Sentence]
Lens' InstanceModel [Sentence]
getNotes)
mkIMField InstanceModel
_ SystemInformation
_ Field
l [(Identifier, [Contents])]
_ = Identifier -> [(Identifier, [Contents])]
forall a. HasCallStack => Identifier -> a
error (Identifier -> [(Identifier, [Contents])])
-> Identifier -> [(Identifier, [Contents])]
forall a b. (a -> b) -> a -> b
$ Identifier
"Label " Identifier -> Identifier -> Identifier
forall a. [a] -> [a] -> [a]
++ Field -> Identifier
forall a. Show a => a -> Identifier
show Field
l Identifier -> Identifier -> Identifier
forall a. [a] -> [a] -> [a]
++ Identifier
" not supported " Identifier -> Identifier -> Identifier
forall a. [a] -> [a] -> [a]
++
Identifier
"for instance models"
firstPair' :: InclUnits -> DataDefinition -> ListTuple
firstPair' :: InclUnits -> DataDefinition -> ListTuple
firstPair' InclUnits
IgnoreUnits DataDefinition
d = (Symbol -> Sentence
P (Symbol -> Sentence) -> Symbol -> Sentence
forall a b. (a -> b) -> a -> b
$ QuantityDict -> Symbol
forall q. HasSymbol q => q -> Symbol
eqSymb (QuantityDict -> Symbol) -> QuantityDict -> Symbol
forall a b. (a -> b) -> a -> b
$ DataDefinition
d DataDefinition
-> Getting QuantityDict DataDefinition QuantityDict -> QuantityDict
forall s a. s -> Getting a s a -> a
^. Getting QuantityDict DataDefinition QuantityDict
forall d. DefinesQuantity d => Getter d QuantityDict
Getter DataDefinition QuantityDict
defLhs, Sentence -> ItemType
Flat (Sentence -> ItemType) -> Sentence -> ItemType
forall a b. (a -> b) -> a -> b
$ DataDefinition -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase DataDefinition
d, Maybe Identifier
forall a. Maybe a
Nothing)
firstPair' InclUnits
IncludeUnits DataDefinition
d =
(Symbol -> Sentence
P (Symbol -> Sentence) -> Symbol -> Sentence
forall a b. (a -> b) -> a -> b
$ QuantityDict -> Symbol
forall q. HasSymbol q => q -> Symbol
eqSymb (QuantityDict -> Symbol) -> QuantityDict -> Symbol
forall a b. (a -> b) -> a -> b
$ DataDefinition
d DataDefinition
-> Getting QuantityDict DataDefinition QuantityDict -> QuantityDict
forall s a. s -> Getting a s a -> a
^. Getting QuantityDict DataDefinition QuantityDict
forall d. DefinesQuantity d => Getter d QuantityDict
Getter DataDefinition QuantityDict
defLhs, Sentence -> ItemType
Flat (Sentence -> ItemType) -> Sentence -> ItemType
forall a b. (a -> b) -> a -> b
$ DataDefinition -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase DataDefinition
d Sentence -> Sentence -> Sentence
+:+ Sentence -> Sentence
sParen (QuantityDict -> Sentence
forall u. MayHaveUnit u => u -> Sentence
toSentenceUnitless (QuantityDict -> Sentence) -> QuantityDict -> Sentence
forall a b. (a -> b) -> a -> b
$ DataDefinition
d DataDefinition
-> Getting QuantityDict DataDefinition QuantityDict -> QuantityDict
forall s a. s -> Getting a s a -> a
^. Getting QuantityDict DataDefinition QuantityDict
forall d. DefinesQuantity d => Getter d QuantityDict
Getter DataDefinition QuantityDict
defLhs), Maybe Identifier
forall a. Maybe a
Nothing)
descPairs :: (Quantity q, MayHaveUnit q) => InclUnits -> [q] -> [ListTuple]
descPairs :: forall q.
(Quantity q, MayHaveUnit q) =>
InclUnits -> [q] -> [ListTuple]
descPairs InclUnits
IgnoreUnits = (q -> ListTuple) -> [q] -> [ListTuple]
forall a b. (a -> b) -> [a] -> [b]
map (\q
x -> (Symbol -> Sentence
P (Symbol -> Sentence) -> Symbol -> Sentence
forall a b. (a -> b) -> a -> b
$ q -> Symbol
forall q. HasSymbol q => q -> Symbol
eqSymb q
x, Sentence -> ItemType
Flat (Sentence -> ItemType) -> Sentence -> ItemType
forall a b. (a -> b) -> a -> b
$ q -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase q
x, Maybe Identifier
forall a. Maybe a
Nothing))
descPairs InclUnits
IncludeUnits =
(q -> ListTuple) -> [q] -> [ListTuple]
forall a b. (a -> b) -> [a] -> [b]
map (\q
x -> (Symbol -> Sentence
P (Symbol -> Sentence) -> Symbol -> Sentence
forall a b. (a -> b) -> a -> b
$ q -> Symbol
forall q. HasSymbol q => q -> Symbol
eqSymb q
x, Sentence -> ItemType
Flat (Sentence -> ItemType) -> Sentence -> ItemType
forall a b. (a -> b) -> a -> b
$ q -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase q
x Sentence -> Sentence -> Sentence
+:+ Sentence -> Sentence
sParen (q -> Sentence
forall u. MayHaveUnit u => u -> Sentence
toSentenceUnitless q
x), Maybe Identifier
forall a. Maybe a
Nothing))
instance Show Field where
show :: Field -> Identifier
show Field
Label = Identifier
"Label"
show Field
Symbol = Identifier
"Symbol"
show Field
Units = Identifier
"Units"
show Field
RefBy = Identifier
"RefBy"
show Field
Source = Identifier
"Source"
show Field
Input = Identifier
"Input"
show Field
Output = Identifier
"Output"
show Field
InConstraints = Identifier
"Input Constraints"
show Field
OutConstraints = Identifier
"Output Constraints"
show Field
DefiningEquation = Identifier
"Equation"
show (Description Verbosity
_ InclUnits
_) = Identifier
"Description"
show Field
Notes = Identifier
"Notes"