{-# Language TupleSections #-}
module Drasil.DocumentLanguage (mkDoc, findAllRefs) where
import Control.Lens ((^.), set)
import Data.Function (on)
import Data.List (nub, sortBy)
import Data.Maybe (maybeToList, mapMaybe)
import qualified Data.Map as Map (keys)
import Utils.Drasil (invert)
import Drasil.DocDecl (SRSDecl, mkDocDesc)
import qualified Drasil.DocDecl as DD
import Drasil.DocumentLanguage.Core (AppndxSec(..), AuxConstntSec(..),
DerivationDisplay(..), DocDesc, DocSection(..), OffShelfSolnsSec(..), GSDSec(..),
GSDSub(..), IntroSec(..), IntroSub(..), LCsSec(..), LFunc(..),
PDSub(..), ProblemDescription(..), RefSec(..), RefTab(..), ReqrmntSec(..),
ReqsSub(..), SCSSub(..), StkhldrSec(..), StkhldrSub(..), SolChSpec(..),
SSDSec(..), SSDSub(..), TraceabilitySec(..), TraceConfig(..),
TSIntro(..), UCsSec(..), getTraceConfigUID)
import Drasil.DocumentLanguage.Definitions (ddefn, derivation, instanceModel,
gdefn, tmodel)
import Drasil.ExtractDocDesc (getDocDesc, egetDocDesc)
import Drasil.TraceTable (generateTraceMap)
import Language.Drasil hiding (kind)
import Language.Drasil.Display (compsy)
import Drasil.Database (findOrErr, ChunkDB, insertAll)
import Drasil.Database.SearchTools (findAllDataDefns, findAllGenDefns,
findAllInstMods, findAllTheoryMods, findAllConcInsts, findAllLabelledContent)
import Drasil.System (System(SI), whatsTheBigIdea, _sys, _systemdb, _quants,
_authors, refTable, refbyTable, traceTable, systemdb, sysName)
import Drasil.GetChunks (ccss, ccss', citeDB)
import Drasil.Sections.TableOfAbbAndAcronyms (tableAbbAccGen)
import Drasil.Sections.TableOfContents (toToC)
import Drasil.Sections.TableOfSymbols (table, tsIntro)
import Drasil.Sections.TableOfUnits (tOfUnitSIName, tuIntro, defaultTUI)
import qualified Drasil.DocLang.SRS as SRS (appendix,
genSysDes, likeChg, unlikeChg, reference, solCharSpec,
stakeholder, tOfCont, tOfSymb, tOfUnit, userChar, offShelfSol, refMat,
tOfAbbAcc)
import Drasil.DocLang.References (secRefs)
import qualified Drasil.Sections.AuxiliaryConstants as AC (valsOfAuxConstantsF)
import qualified Drasil.Sections.GeneralSystDesc as GSD (genSysIntro,
systCon, usrCharsF, sysContxt)
import qualified Drasil.Sections.Introduction as Intro (charIntRdrF,
introductionSection, orgSec, purposeOfDoc, scopeOfRequirements)
import qualified Drasil.Sections.Requirements as R (reqF, fReqF, nfReqF)
import qualified Drasil.Sections.SpecificSystemDescription as SSD (assumpF,
datConF, dataDefnF, genDefnF, goalStmtF, inModelF, physSystDesc, probDescF,
propCorSolF, solutionCharSpecIntro, specSysDescr, termDefnF, thModF, helperCI,
tmStub, ddStub, gdStub, imStub, pdStub)
import qualified Drasil.Sections.Stakeholders as Stk (stakeholderIntro,
tClientF, tCustomerF)
import qualified Drasil.DocumentLanguage.TraceabilityMatrix as TM (
generateTraceTableView, traceMHeader, layoutUIDs)
import qualified Drasil.DocumentLanguage.TraceabilityGraph as TG (traceMGF)
import Drasil.DocumentLanguage.TraceabilityGraph (traceyGraphGetRefs, genTraceGraphLabCons)
import Drasil.Sections.TraceabilityMandGs (traceMatStandard)
import Drasil.Sections.ReferenceMaterial (emptySectSentPlu)
import qualified Data.Drasil.Concepts.Documentation as Doc (likelyChg, section_,
software, unlikelyChg)
import qualified Data.Map.Strict as M
mkDoc :: System -> SRSDecl -> (IdeaDict -> IdeaDict -> Sentence) -> (Document, System)
mkDoc :: System
-> SRSDecl
-> (IdeaDict -> IdeaDict -> Sentence)
-> (Document, System)
mkDoc System
si SRSDecl
srsDecl IdeaDict -> IdeaDict -> Sentence
headingComb =
let dd :: DocDesc
dd = System -> SRSDecl -> DocDesc
mkDocDesc System
si SRSDecl
srsDecl
sections :: [Section]
sections = System -> DocDesc -> [Section]
mkSections System
si DocDesc
dd
si' :: System
si'@SI{ _authors :: System -> People
_authors = People
docAuthors } = DocDesc -> System -> System
fillLC DocDesc
dd (System -> System) -> System -> System
forall a b. (a -> b) -> a -> b
$ [Section] -> System -> System
fillReferences [Section]
sections (System -> System) -> System -> System
forall a b. (a -> b) -> a -> b
$ DocDesc -> System -> System
fillTraceMaps DocDesc
dd System
si
heading :: Sentence
heading = System -> IdeaDict
whatsTheBigIdea System
si IdeaDict -> IdeaDict -> Sentence
`headingComb` System -> IdeaDict
sysName System
si'
authorsList :: Sentence
authorsList = SepType -> FoldType -> [Sentence] -> Sentence
foldlList SepType
Comma FoldType
List ([Sentence] -> Sentence) -> [Sentence] -> Sentence
forall a b. (a -> b) -> a -> b
$ (Person -> Sentence) -> People -> [Sentence]
forall a b. (a -> b) -> [a] -> [b]
map (String -> Sentence
S (String -> Sentence) -> (Person -> String) -> Person -> Sentence
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Person -> String
forall n. HasName n => n -> String
name) People
docAuthors
toc :: ShowTableOfContents
toc = SRSDecl -> ShowTableOfContents
findToC SRSDecl
srsDecl
dd' :: DocDesc
dd' = System -> SRSDecl -> DocDesc
mkDocDesc System
si' SRSDecl
srsDecl
sections' :: [Section]
sections' = System -> DocDesc -> [Section]
mkSections System
si' DocDesc
dd'
in (Sentence
-> Sentence -> ShowTableOfContents -> [Section] -> Document
Document Sentence
heading Sentence
authorsList ShowTableOfContents
toc [Section]
sections', System
si')
fillLC :: DocDesc -> System -> System
fillLC :: DocDesc -> System -> System
fillLC DocDesc
sd si :: System
si@SI{ _sys :: ()
_sys = a
sn }
| DocDesc -> Bool
containsTraceSec DocDesc
sd = System
si2
| Bool
otherwise = System
si
where
chkdb :: ChunkDB
chkdb = System
si System -> Getting ChunkDB System ChunkDB -> ChunkDB
forall s a. s -> Getting a s a -> a
^. Getting ChunkDB System ChunkDB
forall c. HasSystem c => Lens' c ChunkDB
Lens' System ChunkDB
systemdb
createdLCs :: [LabelledContent]
createdLCs = String -> [LabelledContent]
genTraceGraphLabCons (String -> [LabelledContent]) -> String -> [LabelledContent]
forall a b. (a -> b) -> a -> b
$ a -> String
forall c. CommonIdea c => c -> String
programName a
sn
chkdb2 :: ChunkDB
chkdb2 = [LabelledContent] -> ChunkDB -> ChunkDB
forall a. IsChunk a => [a] -> ChunkDB -> ChunkDB
insertAll [LabelledContent]
createdLCs ChunkDB
chkdb
si2 :: System
si2 = ASetter System System ChunkDB ChunkDB
-> ChunkDB -> System -> System
forall s t a b. ASetter s t a b -> b -> s -> t
set ASetter System System ChunkDB ChunkDB
forall c. HasSystem c => Lens' c ChunkDB
Lens' System ChunkDB
systemdb ChunkDB
chkdb2 System
si
containsTraceSec :: DocDesc -> Bool
containsTraceSec :: DocDesc -> Bool
containsTraceSec ((TraceabilitySec TraceabilitySec
_):DocDesc
_) = Bool
True
containsTraceSec (DocSection
_:DocDesc
ss) = DocDesc -> Bool
containsTraceSec DocDesc
ss
containsTraceSec [] = Bool
False
fillReferences :: [Section] -> System -> System
fillReferences :: [Section] -> System -> System
fillReferences [Section]
allSections si :: System
si@SI{_sys :: ()
_sys = a
sys} = System
si2
where
chkdb :: ChunkDB
chkdb = System
si System -> Getting ChunkDB System ChunkDB -> ChunkDB
forall s a. s -> Getting a s a -> a
^. Getting ChunkDB System ChunkDB
forall c. HasSystem c => Lens' c ChunkDB
Lens' System ChunkDB
systemdb
cites :: BibRef
cites = System -> BibRef
citeDB System
si
refsFromSRS :: [Reference]
refsFromSRS = (Section -> [Reference]) -> [Section] -> [Reference]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap Section -> [Reference]
findAllRefs [Section]
allSections
ddefs :: [DataDefinition]
ddefs = ChunkDB -> [DataDefinition]
findAllDataDefns ChunkDB
chkdb
gdefs :: [GenDefn]
gdefs = ChunkDB -> [GenDefn]
findAllGenDefns ChunkDB
chkdb
imods :: [InstanceModel]
imods = ChunkDB -> [InstanceModel]
findAllInstMods ChunkDB
chkdb
tmods :: [TheoryModel]
tmods = ChunkDB -> [TheoryModel]
findAllTheoryMods ChunkDB
chkdb
concIns :: [ConceptInstance]
concIns = ChunkDB -> [ConceptInstance]
findAllConcInsts ChunkDB
chkdb
lblCon :: [LabelledContent]
lblCon = ChunkDB -> [LabelledContent]
findAllLabelledContent ChunkDB
chkdb
newRefs :: Map UID Reference
newRefs = [(UID, Reference)] -> Map UID Reference
forall k a. Ord k => [(k, a)] -> Map k a
M.fromList ([(UID, Reference)] -> Map UID Reference)
-> [(UID, Reference)] -> Map UID Reference
forall a b. (a -> b) -> a -> b
$ (Reference -> (UID, Reference))
-> [Reference] -> [(UID, Reference)]
forall a b. (a -> b) -> [a] -> [b]
map (\Reference
x -> (Reference
x Reference -> Getting UID Reference UID -> UID
forall s a. s -> Getting a s a -> a
^. Getting UID Reference UID
forall c. HasUID c => Getter c UID
Getter Reference UID
uid, Reference
x)) ([Reference] -> [(UID, Reference)])
-> [Reference] -> [(UID, Reference)]
forall a b. (a -> b) -> a -> b
$ [Reference]
refsFromSRS
[Reference] -> [Reference] -> [Reference]
forall a. [a] -> [a] -> [a]
++ (TraceConfig -> Reference) -> [TraceConfig] -> [Reference]
forall a b. (a -> b) -> [a] -> [b]
map (Reference -> Reference
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Reference
ref (Reference -> Reference)
-> (TraceConfig -> Reference) -> TraceConfig -> Reference
forall b c a. (b -> c) -> (a -> b) -> a -> c
. UID -> Reference
makeTabRef' (UID -> Reference)
-> (TraceConfig -> UID) -> TraceConfig -> Reference
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TraceConfig -> UID
getTraceConfigUID) (System -> [TraceConfig]
traceMatStandard System
si)
[Reference] -> [Reference] -> [Reference]
forall a. [a] -> [a] -> [a]
++ [Reference]
secRefs
[Reference] -> [Reference] -> [Reference]
forall a. [a] -> [a] -> [a]
++ String -> [Reference]
traceyGraphGetRefs (a -> String
forall c. CommonIdea c => c -> String
programName a
sys) [Reference] -> [Reference] -> [Reference]
forall a. [a] -> [a] -> [a]
++ (Citation -> Reference) -> BibRef -> [Reference]
forall a b. (a -> b) -> [a] -> [b]
map Citation -> Reference
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Reference
ref BibRef
cites
[Reference] -> [Reference] -> [Reference]
forall a. [a] -> [a] -> [a]
++ (DataDefinition -> Reference) -> [DataDefinition] -> [Reference]
forall a b. (a -> b) -> [a] -> [b]
map DataDefinition -> Reference
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Reference
ref [DataDefinition]
ddefs [Reference] -> [Reference] -> [Reference]
forall a. [a] -> [a] -> [a]
++ (GenDefn -> Reference) -> [GenDefn] -> [Reference]
forall a b. (a -> b) -> [a] -> [b]
map GenDefn -> Reference
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Reference
ref [GenDefn]
gdefs [Reference] -> [Reference] -> [Reference]
forall a. [a] -> [a] -> [a]
++ (InstanceModel -> Reference) -> [InstanceModel] -> [Reference]
forall a b. (a -> b) -> [a] -> [b]
map InstanceModel -> Reference
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Reference
ref [InstanceModel]
imods
[Reference] -> [Reference] -> [Reference]
forall a. [a] -> [a] -> [a]
++ (TheoryModel -> Reference) -> [TheoryModel] -> [Reference]
forall a b. (a -> b) -> [a] -> [b]
map TheoryModel -> Reference
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Reference
ref [TheoryModel]
tmods [Reference] -> [Reference] -> [Reference]
forall a. [a] -> [a] -> [a]
++ (ConceptInstance -> Reference) -> [ConceptInstance] -> [Reference]
forall a b. (a -> b) -> [a] -> [b]
map ConceptInstance -> Reference
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Reference
ref [ConceptInstance]
concIns [Reference] -> [Reference] -> [Reference]
forall a. [a] -> [a] -> [a]
++ (LabelledContent -> Reference) -> [LabelledContent] -> [Reference]
forall a b. (a -> b) -> [a] -> [b]
map LabelledContent -> Reference
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Reference
ref [LabelledContent]
lblCon
si2 :: System
si2 = ASetter System System (Map UID Reference) (Map UID Reference)
-> Map UID Reference -> System -> System
forall s t a b. ASetter s t a b -> b -> s -> t
set ASetter System System (Map UID Reference) (Map UID Reference)
forall c. HasSystem c => Lens' c (Map UID Reference)
Lens' System (Map UID Reference)
refTable (Map UID Reference -> Map UID Reference -> Map UID Reference
forall k a. Ord k => Map k a -> Map k a -> Map k a
M.union (System
si System
-> Getting (Map UID Reference) System (Map UID Reference)
-> Map UID Reference
forall s a. s -> Getting a s a -> a
^. Getting (Map UID Reference) System (Map UID Reference)
forall c. HasSystem c => Lens' c (Map UID Reference)
Lens' System (Map UID Reference)
refTable) Map UID Reference
newRefs) System
si
findAllRefs :: Section -> [Reference]
findAllRefs :: Section -> [Reference]
findAllRefs (Section Sentence
_ [SecCons]
cs Reference
r) = Reference
r Reference -> [Reference] -> [Reference]
forall a. a -> [a] -> [a]
: (SecCons -> [Reference]) -> [SecCons] -> [Reference]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap SecCons -> [Reference]
findRefSecCons [SecCons]
cs
where
findRefSecCons :: SecCons -> [Reference]
findRefSecCons :: SecCons -> [Reference]
findRefSecCons (Sub Section
s) = Section -> [Reference]
findAllRefs Section
s
findRefSecCons (Con (LlC (LblC UID
_ Reference
rf RawContent
_))) = [Reference
rf]
findRefSecCons SecCons
_ = []
fillTraceMaps :: DocDesc -> System -> System
fillTraceMaps :: DocDesc -> System -> System
fillTraceMaps DocDesc
dd System
si = System
si''
where
tdb :: Map UID [UID]
tdb = DocDesc -> Map UID [UID]
generateTraceMap DocDesc
dd
si' :: System
si' = ASetter System System (Map UID [UID]) (Map UID [UID])
-> Map UID [UID] -> System -> System
forall s t a b. ASetter s t a b -> b -> s -> t
set ASetter System System (Map UID [UID]) (Map UID [UID])
forall c. HasSystem c => Lens' c (Map UID [UID])
Lens' System (Map UID [UID])
traceTable Map UID [UID]
tdb System
si
si'' :: System
si'' = ASetter System System (Map UID [UID]) (Map UID [UID])
-> Map UID [UID] -> System -> System
forall s t a b. ASetter s t a b -> b -> s -> t
set ASetter System System (Map UID [UID]) (Map UID [UID])
forall c. HasSystem c => Lens' c (Map UID [UID])
Lens' System (Map UID [UID])
refbyTable (Map UID [UID] -> Map UID [UID]
forall v k. Ord v => Map k [v] -> Map v [k]
invert Map UID [UID]
tdb) System
si'
extractUnits :: DocDesc -> ChunkDB -> [UnitDefn]
DocDesc
dd ChunkDB
cdb = ChunkDB -> [DefinedQuantityDict] -> [UnitDefn]
forall c. Quantity c => ChunkDB -> [c] -> [UnitDefn]
collectUnitDeps ChunkDB
cdb ([DefinedQuantityDict] -> [UnitDefn])
-> [DefinedQuantityDict] -> [UnitDefn]
forall a b. (a -> b) -> a -> b
$ [Sentence] -> [ModelExpr] -> ChunkDB -> [DefinedQuantityDict]
ccss' (DocDesc -> [Sentence]
getDocDesc DocDesc
dd) (DocDesc -> [ModelExpr]
egetDocDesc DocDesc
dd) ChunkDB
cdb
collectUnitDeps :: Quantity c => ChunkDB -> [c] -> [UnitDefn]
collectUnitDeps :: forall c. Quantity c => ChunkDB -> [c] -> [UnitDefn]
collectUnitDeps ChunkDB
db = (UID -> UnitDefn) -> [UID] -> [UnitDefn]
forall a b. (a -> b) -> [a] -> [b]
map (UID -> ChunkDB -> UnitDefn
forall a. Typeable a => UID -> ChunkDB -> a
`findOrErr` ChunkDB
db) ([UID] -> [UnitDefn]) -> ([c] -> [UID]) -> [c] -> [UnitDefn]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (UnitDefn -> [UID]) -> [UnitDefn] -> [UID]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap UnitDefn -> [UID]
forall u. IsUnit u => u -> [UID]
getUnits ([UnitDefn] -> [UID]) -> ([c] -> [UnitDefn]) -> [c] -> [UID]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (c -> Maybe UnitDefn) -> [c] -> [UnitDefn]
forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe (ChunkDB -> c -> Maybe UnitDefn
forall c. HasUID c => ChunkDB -> c -> Maybe UnitDefn
getUnitLup ChunkDB
db)
getUnitLup :: HasUID c => ChunkDB -> c -> Maybe UnitDefn
getUnitLup :: forall c. HasUID c => ChunkDB -> c -> Maybe UnitDefn
getUnitLup ChunkDB
m c
c = DefinedQuantityDict -> Maybe UnitDefn
forall u. MayHaveUnit u => u -> Maybe UnitDefn
getUnit (UID -> ChunkDB -> DefinedQuantityDict
forall a. Typeable a => UID -> ChunkDB -> a
findOrErr (c
c c -> Getting UID c UID -> UID
forall s a. s -> Getting a s a -> a
^. Getting UID c UID
forall c. HasUID c => Getter c UID
Getter c UID
uid) ChunkDB
m :: DefinedQuantityDict)
mkSections :: System -> DocDesc -> [Section]
mkSections :: System -> DocDesc -> [Section]
mkSections System
si DocDesc
dd = (DocSection -> Section) -> DocDesc -> [Section]
forall a b. (a -> b) -> [a] -> [b]
map DocSection -> Section
doit DocDesc
dd
where
doit :: DocSection -> Section
doit :: DocSection -> Section
doit DocSection
TableOfContents = DocDesc -> Section
mkToC DocDesc
dd
doit (RefSec RefSec
rs) = System -> DocDesc -> RefSec -> Section
mkRefSec System
si DocDesc
dd RefSec
rs
doit (IntroSec IntroSec
is) = System -> IntroSec -> Section
mkIntroSec System
si IntroSec
is
doit (StkhldrSec StkhldrSec
sts) = StkhldrSec -> Section
mkStkhldrSec StkhldrSec
sts
doit (SSDSec SSDSec
ss) = System -> SSDSec -> Section
mkSSDSec System
si SSDSec
ss
doit (AuxConstntSec AuxConstntSec
acs) = AuxConstntSec -> Section
mkAuxConsSec AuxConstntSec
acs
doit DocSection
Bibliography = BibRef -> Section
mkBib (System -> BibRef
citeDB System
si)
doit (GSDSec GSDSec
gs') = GSDSec -> Section
mkGSDSec GSDSec
gs'
doit (ReqrmntSec ReqrmntSec
r) = ReqrmntSec -> Section
mkReqrmntSec ReqrmntSec
r
doit (LCsSec LCsSec
lc) = LCsSec -> Section
mkLCsSec LCsSec
lc
doit (UCsSec UCsSec
ulcs) = UCsSec -> Section
mkUCsSec UCsSec
ulcs
doit (TraceabilitySec TraceabilitySec
t) = TraceabilitySec -> System -> Section
mkTraceabilitySec TraceabilitySec
t System
si
doit (AppndxSec AppndxSec
a) = AppndxSec -> Section
mkAppndxSec AppndxSec
a
doit (OffShelfSolnsSec OffShelfSolnsSec
o) = OffShelfSolnsSec -> Section
mkOffShelfSolnSec OffShelfSolnsSec
o
mkToC :: DocDesc -> Section
mkToC :: DocDesc -> Section
mkToC DocDesc
dd = [Contents] -> [Section] -> Section
SRS.tOfCont [Contents
intro, UnlabelledContent -> Contents
UlC (UnlabelledContent -> Contents) -> UnlabelledContent -> Contents
forall a b. (a -> b) -> a -> b
$ RawContent -> UnlabelledContent
ulcc (RawContent -> UnlabelledContent)
-> RawContent -> UnlabelledContent
forall a b. (a -> b) -> a -> b
$ ListType -> RawContent
Enumeration (ListType -> RawContent) -> ListType -> RawContent
forall a b. (a -> b) -> a -> b
$ [(ItemType, Maybe String)] -> ListType
Bullet ([(ItemType, Maybe String)] -> ListType)
-> [(ItemType, Maybe String)] -> ListType
forall a b. (a -> b) -> a -> b
$ (DocSection -> (ItemType, Maybe String))
-> DocDesc -> [(ItemType, Maybe String)]
forall a b. (a -> b) -> [a] -> [b]
map ((, Maybe String
forall a. Maybe a
Nothing) (ItemType -> (ItemType, Maybe String))
-> (DocSection -> ItemType)
-> DocSection
-> (ItemType, Maybe String)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DocSection -> ItemType
toToC) DocDesc
dd] []
where
intro :: Contents
intro = Sentence -> Contents
mkParagraph (Sentence -> Contents) -> Sentence -> Contents
forall a b. (a -> b) -> a -> b
$ String -> Sentence
S String
"An outline of all sections included in this SRS is recorded here for easy reference."
mkRefSec :: System -> DocDesc -> RefSec -> Section
mkRefSec :: System -> DocDesc -> RefSec -> Section
mkRefSec System
si DocDesc
dd (RefProg Contents
c [RefTab]
l) = [Contents] -> [Section] -> Section
SRS.refMat [Contents
c] ((RefTab -> Section) -> [RefTab] -> [Section]
forall a b. (a -> b) -> [a] -> [b]
map (System -> RefTab -> Section
mkSubRef System
si) [RefTab]
l)
where
mkSubRef :: System -> RefTab -> Section
mkSubRef :: System -> RefTab -> Section
mkSubRef System
si' RefTab
TUnits = System -> RefTab -> Section
mkSubRef System
si' (RefTab -> Section) -> RefTab -> Section
forall a b. (a -> b) -> a -> b
$ [TUIntro] -> ([UnitDefn] -> LabelledContent) -> RefTab
TUnits' [TUIntro]
defaultTUI [UnitDefn] -> LabelledContent
forall s. IsUnit s => [s] -> LabelledContent
tOfUnitSIName
mkSubRef SI {_systemdb :: System -> ChunkDB
_systemdb = ChunkDB
db} (TUnits' [TUIntro]
con [UnitDefn] -> LabelledContent
f) =
[Contents] -> [Section] -> Section
SRS.tOfUnit [[TUIntro] -> Contents
tuIntro [TUIntro]
con, LabelledContent -> Contents
LlC (LabelledContent -> Contents) -> LabelledContent -> Contents
forall a b. (a -> b) -> a -> b
$ [UnitDefn] -> LabelledContent
f ([UnitDefn] -> [UnitDefn]
forall a. Eq a => [a] -> [a]
nub ([UnitDefn] -> [UnitDefn]) -> [UnitDefn] -> [UnitDefn]
forall a b. (a -> b) -> a -> b
$ (UnitDefn -> UnitDefn -> Ordering) -> [UnitDefn] -> [UnitDefn]
forall a. (a -> a -> Ordering) -> [a] -> [a]
sortBy UnitDefn -> UnitDefn -> Ordering
compUnitDefn ([UnitDefn] -> [UnitDefn]) -> [UnitDefn] -> [UnitDefn]
forall a b. (a -> b) -> a -> b
$ DocDesc -> ChunkDB -> [UnitDefn]
extractUnits DocDesc
dd ChunkDB
db)] []
mkSubRef SI {_quants :: ()
_quants = [e]
v, _systemdb :: System -> ChunkDB
_systemdb = ChunkDB
cdb} (TSymb [TSIntro]
con) =
[Contents] -> [Section] -> Section
SRS.tOfSymb
[[TSIntro] -> Contents
tsIntro [TSIntro]
con,
LabelledContent -> Contents
LlC (LabelledContent -> Contents) -> LabelledContent -> Contents
forall a b. (a -> b) -> a -> b
$ Stage
-> [DefinedQuantityDict]
-> (DefinedQuantityDict -> Sentence)
-> LabelledContent
forall s.
(Quantity s, MayHaveUnit s) =>
Stage -> [s] -> (s -> Sentence) -> LabelledContent
table Stage
Equational ([DefinedQuantityDict] -> [DefinedQuantityDict]
forall a. HasSymbol a => [a] -> [a]
sortBySymbol
([DefinedQuantityDict] -> [DefinedQuantityDict])
-> [DefinedQuantityDict] -> [DefinedQuantityDict]
forall a b. (a -> b) -> a -> b
$ (DefinedQuantityDict -> Bool)
-> [DefinedQuantityDict] -> [DefinedQuantityDict]
forall a. (a -> Bool) -> [a] -> [a]
filter (DefinedQuantityDict -> Stage -> Bool
forall q. HasSymbol q => q -> Stage -> Bool
`hasStageSymbol` Stage
Equational)
([DefinedQuantityDict] -> [DefinedQuantityDict]
forall a. Eq a => [a] -> [a]
nub ([DefinedQuantityDict] -> [DefinedQuantityDict])
-> [DefinedQuantityDict] -> [DefinedQuantityDict]
forall a b. (a -> b) -> a -> b
$ (e -> DefinedQuantityDict) -> [e] -> [DefinedQuantityDict]
forall a b. (a -> b) -> [a] -> [b]
map e -> DefinedQuantityDict
forall c.
(Quantity c, Concept c, MayHaveUnit c) =>
c -> DefinedQuantityDict
dqdWr [e]
v [DefinedQuantityDict]
-> [DefinedQuantityDict] -> [DefinedQuantityDict]
forall a. [a] -> [a] -> [a]
++ [Sentence] -> [ModelExpr] -> ChunkDB -> [DefinedQuantityDict]
ccss' (DocDesc -> [Sentence]
getDocDesc DocDesc
dd) (DocDesc -> [ModelExpr]
egetDocDesc DocDesc
dd) ChunkDB
cdb))
DefinedQuantityDict -> Sentence
forall n. NamedIdea n => n -> Sentence
atStart] []
mkSubRef SI {_systemdb :: System -> ChunkDB
_systemdb = ChunkDB
cdb} (TSymb' LFunc
f [TSIntro]
con) =
[DefinedQuantityDict] -> LFunc -> [TSIntro] -> Section
forall e.
(Quantity e, Concept e, Eq e, MayHaveUnit e) =>
[e] -> LFunc -> [TSIntro] -> Section
mkTSymb ([Sentence] -> [ModelExpr] -> ChunkDB -> [DefinedQuantityDict]
ccss (DocDesc -> [Sentence]
getDocDesc DocDesc
dd) (DocDesc -> [ModelExpr]
egetDocDesc DocDesc
dd) ChunkDB
cdb) LFunc
f [TSIntro]
con
mkSubRef System
_ (TAandA [IdeaDict]
ideas) =
[Contents] -> [Section] -> Section
SRS.tOfAbbAcc
[LabelledContent -> Contents
LlC (LabelledContent -> Contents) -> LabelledContent -> Contents
forall a b. (a -> b) -> a -> b
$ [IdeaDict] -> LabelledContent
forall s. Idea s => [s] -> LabelledContent
tableAbbAccGen ([IdeaDict] -> LabelledContent) -> [IdeaDict] -> LabelledContent
forall a b. (a -> b) -> a -> b
$ [IdeaDict] -> [IdeaDict]
forall a. Eq a => [a] -> [a]
nub [IdeaDict]
ideas]
[]
mkTSymb :: (Quantity e, Concept e, Eq e, MayHaveUnit e) =>
[e] -> LFunc -> [TSIntro] -> Section
mkTSymb :: forall e.
(Quantity e, Concept e, Eq e, MayHaveUnit e) =>
[e] -> LFunc -> [TSIntro] -> Section
mkTSymb [e]
v LFunc
f [TSIntro]
c = [Contents] -> [Section] -> Section
SRS.tOfSymb [[TSIntro] -> Contents
tsIntro [TSIntro]
c,
LabelledContent -> Contents
LlC (LabelledContent -> Contents) -> LabelledContent -> Contents
forall a b. (a -> b) -> a -> b
$ Stage -> [e] -> (e -> Sentence) -> LabelledContent
forall s.
(Quantity s, MayHaveUnit s) =>
Stage -> [s] -> (s -> Sentence) -> LabelledContent
table Stage
Equational
((e -> e -> Ordering) -> [e] -> [e]
forall a. (a -> a -> Ordering) -> [a] -> [a]
sortBy (Symbol -> Symbol -> Ordering
compsy (Symbol -> Symbol -> Ordering)
-> (e -> Symbol) -> e -> e -> Ordering
forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
`on` e -> Symbol
forall q. HasSymbol q => q -> Symbol
eqSymb) ([e] -> [e]) -> [e] -> [e]
forall a b. (a -> b) -> a -> b
$ (e -> Bool) -> [e] -> [e]
forall a. (a -> Bool) -> [a] -> [a]
filter (e -> Stage -> Bool
forall q. HasSymbol q => q -> Stage -> Bool
`hasStageSymbol` Stage
Equational) ([e] -> [e]
forall a. Eq a => [a] -> [a]
nub [e]
v))
(LFunc -> e -> Sentence
forall {n}. (NamedIdea n, Definition n) => LFunc -> n -> Sentence
lf LFunc
f)]
[]
where lf :: LFunc -> n -> Sentence
lf LFunc
Term = n -> Sentence
forall n. NamedIdea n => n -> Sentence
atStart
lf LFunc
Defn = Sentence -> Sentence
capSent (Sentence -> Sentence) -> (n -> Sentence) -> n -> Sentence
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (n -> Getting Sentence n Sentence -> Sentence
forall s a. s -> Getting a s a -> a
^. Getting Sentence n Sentence
forall c. Definition c => Lens' c Sentence
Lens' n Sentence
defn)
lf (TermExcept [DefinedQuantityDict]
cs) = \n
x -> if (n
x n -> Getting UID n UID -> UID
forall s a. s -> Getting a s a -> a
^. Getting UID n UID
forall c. HasUID c => Getter c UID
Getter n UID
uid) UID -> [UID] -> Bool
forall a. Eq a => a -> [a] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` (DefinedQuantityDict -> UID) -> [DefinedQuantityDict] -> [UID]
forall a b. (a -> b) -> [a] -> [b]
map (DefinedQuantityDict -> Getting UID DefinedQuantityDict UID -> UID
forall s a. s -> Getting a s a -> a
^. Getting UID DefinedQuantityDict UID
forall c. HasUID c => Getter c UID
Getter DefinedQuantityDict UID
uid) [DefinedQuantityDict]
cs then
Sentence -> Sentence
capSent (n
x n -> Getting Sentence n Sentence -> Sentence
forall s a. s -> Getting a s a -> a
^. Getting Sentence n Sentence
forall c. Definition c => Lens' c Sentence
Lens' n Sentence
defn) else n -> Sentence
forall n. NamedIdea n => n -> Sentence
atStart n
x
lf (DefnExcept [DefinedQuantityDict]
cs) = \n
x -> if (n
x n -> Getting UID n UID -> UID
forall s a. s -> Getting a s a -> a
^. Getting UID n UID
forall c. HasUID c => Getter c UID
Getter n UID
uid) UID -> [UID] -> Bool
forall a. Eq a => a -> [a] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` (DefinedQuantityDict -> UID) -> [DefinedQuantityDict] -> [UID]
forall a b. (a -> b) -> [a] -> [b]
map (DefinedQuantityDict -> Getting UID DefinedQuantityDict UID -> UID
forall s a. s -> Getting a s a -> a
^.Getting UID DefinedQuantityDict UID
forall c. HasUID c => Getter c UID
Getter DefinedQuantityDict UID
uid) [DefinedQuantityDict]
cs then
n -> Sentence
forall n. NamedIdea n => n -> Sentence
atStart n
x else Sentence -> Sentence
capSent (n
x n -> Getting Sentence n Sentence -> Sentence
forall s a. s -> Getting a s a -> a
^. Getting Sentence n Sentence
forall c. Definition c => Lens' c Sentence
Lens' n Sentence
defn)
lf LFunc
TAD = \n
tDef -> n -> Sentence
forall n. NamedIdea n => n -> Sentence
titleize n
tDef Sentence -> Sentence -> Sentence
+: Sentence
EmptyS Sentence -> Sentence -> Sentence
+:+. Sentence -> Sentence
capSent (n
tDef n -> Getting Sentence n Sentence -> Sentence
forall s a. s -> Getting a s a -> a
^. Getting Sentence n Sentence
forall c. Definition c => Lens' c Sentence
Lens' n Sentence
defn)
mkIntroSec :: System -> IntroSec -> Section
mkIntroSec :: System -> IntroSec -> Section
mkIntroSec System
si (IntroProg Sentence
probIntro Sentence
progDefn [IntroSub]
l) =
Sentence -> Sentence -> [Section] -> Section
Intro.introductionSection Sentence
probIntro Sentence
progDefn ([Section] -> Section) -> [Section] -> Section
forall a b. (a -> b) -> a -> b
$ (IntroSub -> Section) -> [IntroSub] -> [Section]
forall a b. (a -> b) -> [a] -> [b]
map (System -> IntroSub -> Section
mkSubIntro System
si) [IntroSub]
l
where
mkSubIntro :: System -> IntroSub -> Section
mkSubIntro :: System -> IntroSub -> Section
mkSubIntro System
_ (IPurpose [Sentence]
intro) = [Sentence] -> Section
Intro.purposeOfDoc [Sentence]
intro
mkSubIntro System
_ (IScope Sentence
main) = Sentence -> Section
Intro.scopeOfRequirements Sentence
main
mkSubIntro SI {_sys :: ()
_sys = a
sys} (IChar [Sentence]
assumed [Sentence]
topic [Sentence]
asset) =
a -> [Sentence] -> [Sentence] -> [Sentence] -> Section -> Section
forall a.
Idea a =>
a -> [Sentence] -> [Sentence] -> [Sentence] -> Section -> Section
Intro.charIntRdrF a
sys [Sentence]
assumed [Sentence]
topic [Sentence]
asset ([Contents] -> [Section] -> Section
SRS.userChar [] [])
mkSubIntro System
_ (IOrgSec CI
b Section
s Sentence
t) = CI -> Section -> Sentence -> Section
forall c. NamedIdea c => c -> Section -> Sentence -> Section
Intro.orgSec CI
b Section
s Sentence
t
mkStkhldrSec :: StkhldrSec -> Section
mkStkhldrSec :: StkhldrSec -> Section
mkStkhldrSec (StkhldrProg [StkhldrSub]
l) = [Contents] -> [Section] -> Section
SRS.stakeholder [Contents
Stk.stakeholderIntro] ([Section] -> Section) -> [Section] -> Section
forall a b. (a -> b) -> a -> b
$ (StkhldrSub -> Section) -> [StkhldrSub] -> [Section]
forall a b. (a -> b) -> [a] -> [b]
map StkhldrSub -> Section
mkSubs [StkhldrSub]
l
where
mkSubs :: StkhldrSub -> Section
mkSubs :: StkhldrSub -> Section
mkSubs (Client CI
kWrd Sentence
details) = CI -> Sentence -> Section
forall a. Idea a => a -> Sentence -> Section
Stk.tClientF CI
kWrd Sentence
details
mkSubs (Cstmr CI
kWrd) = CI -> Section
forall a. Idea a => a -> Section
Stk.tCustomerF CI
kWrd
mkGSDSec :: GSDSec -> Section
mkGSDSec :: GSDSec -> Section
mkGSDSec (GSDProg [GSDSub]
l) = [Contents] -> [Section] -> Section
SRS.genSysDes [Contents
GSD.genSysIntro] ([Section] -> Section) -> [Section] -> Section
forall a b. (a -> b) -> a -> b
$ (GSDSub -> Section) -> [GSDSub] -> [Section]
forall a b. (a -> b) -> [a] -> [b]
map GSDSub -> Section
mkSubs [GSDSub]
l
where
mkSubs :: GSDSub -> Section
mkSubs :: GSDSub -> Section
mkSubs (SysCntxt [Contents]
cs) = [Contents] -> Section
GSD.sysContxt [Contents]
cs
mkSubs (UsrChars [Contents]
intro) = [Contents] -> Section
GSD.usrCharsF [Contents]
intro
mkSubs (SystCons [Contents]
cntnts [Section]
subsec) = [Contents] -> [Section] -> Section
GSD.systCon [Contents]
cntnts [Section]
subsec
mkSSDSec :: System -> SSDSec -> Section
mkSSDSec :: System -> SSDSec -> Section
mkSSDSec System
si (SSDProg [SSDSub]
l) =
[Section] -> Section
SSD.specSysDescr ([Section] -> Section) -> [Section] -> Section
forall a b. (a -> b) -> a -> b
$ (SSDSub -> Section) -> [SSDSub] -> [Section]
forall a b. (a -> b) -> [a] -> [b]
map (System -> SSDSub -> Section
mkSubSSD System
si) [SSDSub]
l
where
mkSubSSD :: System -> SSDSub -> Section
mkSubSSD :: System -> SSDSub -> Section
mkSubSSD System
sysi (SSDProblem ProblemDescription
pd) = System -> ProblemDescription -> Section
mkSSDProb System
sysi ProblemDescription
pd
mkSubSSD System
sysi (SSDSolChSpec SolChSpec
scs) = System -> SolChSpec -> Section
mkSolChSpec System
sysi SolChSpec
scs
mkSSDProb :: System -> ProblemDescription -> Section
mkSSDProb :: System -> ProblemDescription -> Section
mkSSDProb System
_ (PDProg Sentence
prob [Section]
subSec [PDSub]
subPD) = Sentence -> [Section] -> Section
SSD.probDescF Sentence
prob ([Section]
subSec [Section] -> [Section] -> [Section]
forall a. [a] -> [a] -> [a]
++ (PDSub -> Section) -> [PDSub] -> [Section]
forall a b. (a -> b) -> [a] -> [b]
map PDSub -> Section
mkSubPD [PDSub]
subPD)
where mkSubPD :: PDSub -> Section
mkSubPD (TermsAndDefs Maybe Sentence
sen [c]
concepts) = Maybe Sentence -> [c] -> Section
forall c. Concept c => Maybe Sentence -> [c] -> Section
SSD.termDefnF Maybe Sentence
sen [c]
concepts
mkSubPD (PhySysDesc a
prog [Sentence]
parts LabelledContent
dif [Contents]
extra) = a -> [Sentence] -> LabelledContent -> [Contents] -> Section
forall a.
Idea a =>
a -> [Sentence] -> LabelledContent -> [Contents] -> Section
SSD.physSystDesc a
prog [Sentence]
parts LabelledContent
dif [Contents]
extra
mkSubPD (Goals [Sentence]
ins [ConceptInstance]
g) = [Sentence] -> [Contents] -> Int -> Section
SSD.goalStmtF [Sentence]
ins ([ConceptInstance] -> [Contents]
forall c.
(Referable c, HasShortName c, Definition c) =>
[c] -> [Contents]
mkEnumSimpleD [ConceptInstance]
g) ([ConceptInstance] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [ConceptInstance]
g)
mkSolChSpec :: System -> SolChSpec -> Section
mkSolChSpec :: System -> SolChSpec -> Section
mkSolChSpec System
si (SCSProg [SCSSub]
l) =
[Contents] -> [Section] -> Section
SRS.solCharSpec [IdeaDict -> Section -> Contents
forall a. Idea a => a -> Section -> Contents
SSD.solutionCharSpecIntro (System -> IdeaDict
sysName System
si) Section
SSD.imStub] ([Section] -> Section) -> [Section] -> Section
forall a b. (a -> b) -> a -> b
$
(SCSSub -> Section) -> [SCSSub] -> [Section]
forall a b. (a -> b) -> [a] -> [b]
map (System -> SCSSub -> Section
mkSubSCS System
si) [SCSSub]
l
where
mkSubSCS :: System -> SCSSub -> Section
mkSubSCS :: System -> SCSSub -> Section
mkSubSCS System
si' (TMs [Sentence]
intro Fields
fields [TheoryModel]
ts) =
IdeaDict -> [Contents] -> Section
forall a. Idea a => a -> [Contents] -> Section
SSD.thModF (System -> IdeaDict
sysName System
si') ([Contents] -> Section) -> [Contents] -> Section
forall a b. (a -> b) -> a -> b
$ (Sentence -> Contents) -> [Sentence] -> [Contents]
forall a b. (a -> b) -> [a] -> [b]
map Sentence -> Contents
mkParagraph [Sentence]
intro [Contents] -> [Contents] -> [Contents]
forall a. [a] -> [a] -> [a]
++ (TheoryModel -> Contents) -> [TheoryModel] -> [Contents]
forall a b. (a -> b) -> [a] -> [b]
map (LabelledContent -> Contents
LlC (LabelledContent -> Contents)
-> (TheoryModel -> LabelledContent) -> TheoryModel -> Contents
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Fields -> System -> TheoryModel -> LabelledContent
tmodel Fields
fields System
si') [TheoryModel]
ts
mkSubSCS System
si' (DDs [Sentence]
intro Fields
fields [DataDefinition]
dds DerivationDisplay
ShowDerivation) =
Sentence -> [Contents] -> Section
SSD.dataDefnF Sentence
EmptyS ([Contents] -> Section) -> [Contents] -> Section
forall a b. (a -> b) -> a -> b
$ (Sentence -> Contents) -> [Sentence] -> [Contents]
forall a b. (a -> b) -> [a] -> [b]
map Sentence -> Contents
mkParagraph [Sentence]
intro [Contents] -> [Contents] -> [Contents]
forall a. [a] -> [a] -> [a]
++ (DataDefinition -> [Contents]) -> [DataDefinition] -> [Contents]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap DataDefinition -> [Contents]
f [DataDefinition]
dds
where f :: DataDefinition -> [Contents]
f DataDefinition
e = LabelledContent -> Contents
LlC (Fields -> System -> DataDefinition -> LabelledContent
ddefn Fields
fields System
si' DataDefinition
e) Contents -> [Contents] -> [Contents]
forall a. a -> [a] -> [a]
: Maybe Contents -> [Contents]
forall a. Maybe a -> [a]
maybeToList (DataDefinition -> Maybe Contents
forall c.
(MayHaveDerivation c, HasShortName c, Referable c) =>
c -> Maybe Contents
derivation DataDefinition
e)
mkSubSCS System
si' (DDs [Sentence]
intro Fields
fields [DataDefinition]
dds DerivationDisplay
_) =
Sentence -> [Contents] -> Section
SSD.dataDefnF Sentence
EmptyS ([Contents] -> Section) -> [Contents] -> Section
forall a b. (a -> b) -> a -> b
$ (Sentence -> Contents) -> [Sentence] -> [Contents]
forall a b. (a -> b) -> [a] -> [b]
map Sentence -> Contents
mkParagraph [Sentence]
intro [Contents] -> [Contents] -> [Contents]
forall a. [a] -> [a] -> [a]
++ (DataDefinition -> Contents) -> [DataDefinition] -> [Contents]
forall a b. (a -> b) -> [a] -> [b]
map DataDefinition -> Contents
f [DataDefinition]
dds
where f :: DataDefinition -> Contents
f DataDefinition
e = LabelledContent -> Contents
LlC (LabelledContent -> Contents) -> LabelledContent -> Contents
forall a b. (a -> b) -> a -> b
$ Fields -> System -> DataDefinition -> LabelledContent
ddefn Fields
fields System
si' DataDefinition
e
mkSubSCS System
si' (GDs [Sentence]
intro Fields
fields [GenDefn]
gs' DerivationDisplay
ShowDerivation) =
[Contents] -> Section
SSD.genDefnF ([Contents] -> Section) -> [Contents] -> Section
forall a b. (a -> b) -> a -> b
$ (Sentence -> Contents) -> [Sentence] -> [Contents]
forall a b. (a -> b) -> [a] -> [b]
map Sentence -> Contents
mkParagraph [Sentence]
intro [Contents] -> [Contents] -> [Contents]
forall a. [a] -> [a] -> [a]
++ (GenDefn -> [Contents]) -> [GenDefn] -> [Contents]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\GenDefn
x -> LabelledContent -> Contents
LlC (Fields -> System -> GenDefn -> LabelledContent
gdefn Fields
fields System
si' GenDefn
x) Contents -> [Contents] -> [Contents]
forall a. a -> [a] -> [a]
: Maybe Contents -> [Contents]
forall a. Maybe a -> [a]
maybeToList (GenDefn -> Maybe Contents
forall c.
(MayHaveDerivation c, HasShortName c, Referable c) =>
c -> Maybe Contents
derivation GenDefn
x)) [GenDefn]
gs'
mkSubSCS System
si' (GDs [Sentence]
intro Fields
fields [GenDefn]
gs' DerivationDisplay
_) =
[Contents] -> Section
SSD.genDefnF ([Contents] -> Section) -> [Contents] -> Section
forall a b. (a -> b) -> a -> b
$ (Sentence -> Contents) -> [Sentence] -> [Contents]
forall a b. (a -> b) -> [a] -> [b]
map Sentence -> Contents
mkParagraph [Sentence]
intro [Contents] -> [Contents] -> [Contents]
forall a. [a] -> [a] -> [a]
++ (GenDefn -> Contents) -> [GenDefn] -> [Contents]
forall a b. (a -> b) -> [a] -> [b]
map (LabelledContent -> Contents
LlC (LabelledContent -> Contents)
-> (GenDefn -> LabelledContent) -> GenDefn -> Contents
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Fields -> System -> GenDefn -> LabelledContent
gdefn Fields
fields System
si') [GenDefn]
gs'
mkSubSCS System
si' (IMs [Sentence]
intro Fields
fields [InstanceModel]
ims DerivationDisplay
ShowDerivation) =
Section -> Section -> Section -> Section -> [Contents] -> Section
SSD.inModelF Section
SSD.pdStub Section
SSD.ddStub Section
SSD.tmStub Section
SSD.gdStub ([Contents] -> Section) -> [Contents] -> Section
forall a b. (a -> b) -> a -> b
$ (Sentence -> Contents) -> [Sentence] -> [Contents]
forall a b. (a -> b) -> [a] -> [b]
map Sentence -> Contents
mkParagraph [Sentence]
intro [Contents] -> [Contents] -> [Contents]
forall a. [a] -> [a] -> [a]
++
(InstanceModel -> [Contents]) -> [InstanceModel] -> [Contents]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\InstanceModel
x -> LabelledContent -> Contents
LlC (Fields -> System -> InstanceModel -> LabelledContent
instanceModel Fields
fields System
si' InstanceModel
x) Contents -> [Contents] -> [Contents]
forall a. a -> [a] -> [a]
: Maybe Contents -> [Contents]
forall a. Maybe a -> [a]
maybeToList (InstanceModel -> Maybe Contents
forall c.
(MayHaveDerivation c, HasShortName c, Referable c) =>
c -> Maybe Contents
derivation InstanceModel
x)) [InstanceModel]
ims
mkSubSCS System
si' (IMs [Sentence]
intro Fields
fields [InstanceModel]
ims DerivationDisplay
_) =
Section -> Section -> Section -> Section -> [Contents] -> Section
SSD.inModelF Section
SSD.pdStub Section
SSD.ddStub Section
SSD.tmStub Section
SSD.gdStub ([Contents] -> Section) -> [Contents] -> Section
forall a b. (a -> b) -> a -> b
$ (Sentence -> Contents) -> [Sentence] -> [Contents]
forall a b. (a -> b) -> [a] -> [b]
map Sentence -> Contents
mkParagraph [Sentence]
intro [Contents] -> [Contents] -> [Contents]
forall a. [a] -> [a] -> [a]
++
(InstanceModel -> Contents) -> [InstanceModel] -> [Contents]
forall a b. (a -> b) -> [a] -> [b]
map (LabelledContent -> Contents
LlC (LabelledContent -> Contents)
-> (InstanceModel -> LabelledContent) -> InstanceModel -> Contents
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Fields -> System -> InstanceModel -> LabelledContent
instanceModel Fields
fields System
si') [InstanceModel]
ims
mkSubSCS System
si' (Assumptions [ConceptInstance]
ci) =
[Contents] -> Section
SSD.assumpF ([Contents] -> Section) -> [Contents] -> Section
forall a b. (a -> b) -> a -> b
$ [ConceptInstance] -> [Contents]
forall c.
(Referable c, HasShortName c, Definition c) =>
[c] -> [Contents]
mkEnumSimpleD ([ConceptInstance] -> [Contents])
-> [ConceptInstance] -> [Contents]
forall a b. (a -> b) -> a -> b
$ (ConceptInstance -> ConceptInstance)
-> [ConceptInstance] -> [ConceptInstance]
forall a b. (a -> b) -> [a] -> [b]
map (ConceptInstance -> System -> ConceptInstance
`SSD.helperCI` System
si') [ConceptInstance]
ci
mkSubSCS System
_ (Constraints Sentence
end [c]
cs) = Sentence -> [c] -> Section
forall c.
(HasUncertainty c, Quantity c, Constrained c, HasReasVal c,
MayHaveUnit c) =>
Sentence -> [c] -> Section
SSD.datConF Sentence
end [c]
cs
mkSubSCS System
_ (CorrSolnPpties [c]
c [Contents]
cs) = [c] -> [Contents] -> Section
forall c.
(Quantity c, Constrained c) =>
[c] -> [Contents] -> Section
SSD.propCorSolF [c]
c [Contents]
cs
mkReqrmntSec :: ReqrmntSec -> Section
mkReqrmntSec :: ReqrmntSec -> Section
mkReqrmntSec (ReqsProg [ReqsSub]
l) = [Section] -> Section
R.reqF ([Section] -> Section) -> [Section] -> Section
forall a b. (a -> b) -> a -> b
$ (ReqsSub -> Section) -> [ReqsSub] -> [Section]
forall a b. (a -> b) -> [a] -> [b]
map ReqsSub -> Section
mkSubs [ReqsSub]
l
where
mkSubs :: ReqsSub -> Section
mkSubs :: ReqsSub -> Section
mkSubs (FReqsSub [ConceptInstance]
frs [LabelledContent]
tbs) = [Contents] -> Section
R.fReqF ([ConceptInstance] -> [Contents]
forall c.
(Referable c, HasShortName c, Definition c) =>
[c] -> [Contents]
mkEnumSimpleD [ConceptInstance]
frs [Contents] -> [Contents] -> [Contents]
forall a. [a] -> [a] -> [a]
++ (LabelledContent -> Contents) -> [LabelledContent] -> [Contents]
forall a b. (a -> b) -> [a] -> [b]
map LabelledContent -> Contents
LlC [LabelledContent]
tbs)
mkSubs (NonFReqsSub [ConceptInstance]
nfrs) = [Contents] -> Section
R.nfReqF ([ConceptInstance] -> [Contents]
forall c.
(Referable c, HasShortName c, Definition c) =>
[c] -> [Contents]
mkEnumSimpleD [ConceptInstance]
nfrs)
mkLCsSec :: LCsSec -> Section
mkLCsSec :: LCsSec -> Section
mkLCsSec (LCsProg [ConceptInstance]
c) = [Contents] -> [Section] -> Section
SRS.likeChg (CI -> [ConceptInstance] -> Contents
forall n. NamedIdea n => n -> [ConceptInstance] -> Contents
introChgs CI
Doc.likelyChg [ConceptInstance]
cContents -> [Contents] -> [Contents]
forall a. a -> [a] -> [a]
: [ConceptInstance] -> [Contents]
forall c.
(Referable c, HasShortName c, Definition c) =>
[c] -> [Contents]
mkEnumSimpleD [ConceptInstance]
c) []
mkUCsSec :: UCsSec -> Section
mkUCsSec :: UCsSec -> Section
mkUCsSec (UCsProg [ConceptInstance]
c) = [Contents] -> [Section] -> Section
SRS.unlikeChg (CI -> [ConceptInstance] -> Contents
forall n. NamedIdea n => n -> [ConceptInstance] -> Contents
introChgs CI
Doc.unlikelyChg [ConceptInstance]
c Contents -> [Contents] -> [Contents]
forall a. a -> [a] -> [a]
: [ConceptInstance] -> [Contents]
forall c.
(Referable c, HasShortName c, Definition c) =>
[c] -> [Contents]
mkEnumSimpleD [ConceptInstance]
c) []
introChgs :: NamedIdea n => n -> [ConceptInstance] -> Contents
introChgs :: forall n. NamedIdea n => n -> [ConceptInstance] -> Contents
introChgs n
xs [] = Sentence -> Contents
mkParagraph (Sentence -> Contents) -> Sentence -> Contents
forall a b. (a -> b) -> a -> b
$ [n] -> Sentence
forall n. NamedIdea n => [n] -> Sentence
emptySectSentPlu [n
xs]
introChgs n
xs [ConceptInstance]
_ = [Sentence] -> Contents
foldlSP [String -> Sentence
S String
"This", IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
Doc.section_, String -> Sentence
S String
"lists the",
n -> Sentence
forall n. NamedIdea n => n -> Sentence
plural n
xs, String -> Sentence
S String
"to be made to the", IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
Doc.software]
mkTraceabilitySec :: TraceabilitySec -> System -> Section
mkTraceabilitySec :: TraceabilitySec -> System -> Section
mkTraceabilitySec (TraceabilityProg [TraceConfig]
progs) si :: System
si@SI{_sys :: ()
_sys = a
sys} = [LabelledContent]
-> [Sentence] -> [Contents] -> String -> [Section] -> Section
TG.traceMGF [LabelledContent]
trace
((TraceConfig -> Sentence) -> [TraceConfig] -> [Sentence]
forall a b. (a -> b) -> [a] -> [b]
map (\(TraceConfig UID
_ [Sentence]
pre Sentence
_ [TraceViewCat]
_ [TraceViewCat]
_) -> SepType -> FoldType -> [Sentence] -> Sentence
foldlList SepType
Comma FoldType
List [Sentence]
pre) [TraceConfig]
fProgs)
((LabelledContent -> Contents) -> [LabelledContent] -> [Contents]
forall a b. (a -> b) -> [a] -> [b]
map LabelledContent -> Contents
LlC [LabelledContent]
trace) (a -> String
forall c. CommonIdea c => c -> String
programName a
sys) []
where
trace :: [LabelledContent]
trace = (TraceConfig -> LabelledContent)
-> [TraceConfig] -> [LabelledContent]
forall a b. (a -> b) -> [a] -> [b]
map (\(TraceConfig UID
u [Sentence]
_ Sentence
desc [TraceViewCat]
cols [TraceViewCat]
rows) ->
UID
-> Sentence
-> [TraceViewCat]
-> [TraceViewCat]
-> System
-> LabelledContent
TM.generateTraceTableView UID
u Sentence
desc [TraceViewCat]
cols [TraceViewCat]
rows System
si) [TraceConfig]
fProgs
fProgs :: [TraceConfig]
fProgs = (TraceConfig -> Bool) -> [TraceConfig] -> [TraceConfig]
forall a. (a -> Bool) -> [a] -> [a]
filter (\(TraceConfig UID
_ [Sentence]
_ Sentence
_ [TraceViewCat]
cols [TraceViewCat]
rows) ->
Bool -> Bool
not (Bool -> Bool) -> Bool -> Bool
forall a b. (a -> b) -> a -> b
$ [Sentence] -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null (([UID] -> [UID]) -> System -> [Sentence]
header ([TraceViewCat] -> System -> [UID] -> [UID]
TM.layoutUIDs [TraceViewCat]
rows System
si) System
si)
Bool -> Bool -> Bool
|| [Sentence] -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null (([UID] -> [UID]) -> System -> [Sentence]
header ([TraceViewCat] -> System -> [UID] -> [UID]
TM.layoutUIDs [TraceViewCat]
cols System
si) System
si)) [TraceConfig]
progs
header :: ([UID] -> [UID]) -> System -> [Sentence]
[UID] -> [UID]
f = (System -> [UID]) -> System -> [Sentence]
TM.traceMHeader ([UID] -> [UID]
f ([UID] -> [UID]) -> (System -> [UID]) -> System -> [UID]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Map UID [UID] -> [UID]
forall k a. Map k a -> [k]
Map.keys (Map UID [UID] -> [UID])
-> (System -> Map UID [UID]) -> System -> [UID]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (System
-> Getting (Map UID [UID]) System (Map UID [UID]) -> Map UID [UID]
forall s a. s -> Getting a s a -> a
^. Getting (Map UID [UID]) System (Map UID [UID])
forall c. HasSystem c => Lens' c (Map UID [UID])
Lens' System (Map UID [UID])
refbyTable))
mkOffShelfSolnSec :: OffShelfSolnsSec -> Section
mkOffShelfSolnSec :: OffShelfSolnsSec -> Section
mkOffShelfSolnSec (OffShelfSolnsProg [Contents]
cs) = [Contents] -> [Section] -> Section
SRS.offShelfSol [Contents]
cs []
mkAuxConsSec :: AuxConstntSec -> Section
mkAuxConsSec :: AuxConstntSec -> Section
mkAuxConsSec (AuxConsProg CI
key [ConstQDef]
listOfCons) = CI -> [ConstQDef] -> Section
forall a. Idea a => a -> [ConstQDef] -> Section
AC.valsOfAuxConstantsF CI
key ([ConstQDef] -> Section) -> [ConstQDef] -> Section
forall a b. (a -> b) -> a -> b
$ [ConstQDef] -> [ConstQDef]
forall a. HasSymbol a => [a] -> [a]
sortBySymbol [ConstQDef]
listOfCons
mkBib :: BibRef -> Section
mkBib :: BibRef -> Section
mkBib BibRef
bib = [Contents] -> [Section] -> Section
SRS.reference [UnlabelledContent -> Contents
UlC (UnlabelledContent -> Contents) -> UnlabelledContent -> Contents
forall a b. (a -> b) -> a -> b
$ RawContent -> UnlabelledContent
ulcc (BibRef -> RawContent
Bib BibRef
bib)] []
mkAppndxSec :: AppndxSec -> Section
mkAppndxSec :: AppndxSec -> Section
mkAppndxSec (AppndxProg [Contents]
cs) = [Contents] -> [Section] -> Section
SRS.appendix [Contents]
cs []
findToC :: SRSDecl -> ShowTableOfContents
findToC :: SRSDecl -> ShowTableOfContents
findToC [] = ShowTableOfContents
NoToC
findToC (DocSection
DD.TableOfContents:SRSDecl
_) = ShowTableOfContents
ToC
findToC (DocSection
_:SRSDecl
dds) = SRSDecl -> ShowTableOfContents
findToC SRSDecl
dds