{-# Language TupleSections #-}
module Drasil.DocumentLanguage where
import Drasil.DocDecl (SRSDecl, mkDocDesc)
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
import Language.Drasil.Display (compsy)
import Database.Drasil hiding (cdb)
import SysInfo.Drasil
import Drasil.Sections.TableOfAbbAndAcronyms (tableAbbAccGen)
import Drasil.Sections.TableOfContents (toToC, findToC)
import Drasil.Sections.TableOfSymbols (table, tsIntro)
import Drasil.Sections.TableOfUnits (tOfUnitSIName, tuIntro, defaultTUI)
import qualified Drasil.DocLang.SRS as SRS (appendix, genDefn,
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, imStub, pdStub)
import qualified Drasil.Sections.Stakeholders as Stk (stakeholderIntro,
tClientF, tCustomerF)
import qualified Drasil.DocumentLanguage.TraceabilityMatrix as TM (
generateTraceTableView)
import qualified Drasil.DocumentLanguage.TraceabilityGraph as TG (traceMGF)
import Drasil.DocumentLanguage.TraceabilityGraph (traceyGraphGetRefs)
import Drasil.Sections.TraceabilityMandGs (traceMatStandard)
import qualified Data.Drasil.Concepts.Documentation as Doc (likelyChg, section_,
software, unlikelyChg)
import Control.Lens ((^.), set)
import Data.Function (on)
import Data.List (nub, sortBy, sortOn)
import qualified Data.Map as Map (elems, toList, assocs)
import Data.Char (isSpace)
mkDoc :: SRSDecl -> (IdeaDict -> IdeaDict -> Sentence) -> SystemInformation -> Document
mkDoc :: SRSDecl
-> (IdeaDict -> IdeaDict -> Sentence)
-> SystemInformation
-> Document
mkDoc dd :: SRSDecl
dd comb :: IdeaDict -> IdeaDict -> Sentence
comb si :: SystemInformation
si@SI {_sys :: ()
_sys = a
sys, _kind :: ()
_kind = b
kind, _authors :: ()
_authors = [c]
authors} =
Sentence
-> Sentence -> ShowTableOfContents -> [Section] -> Document
Document (b -> IdeaDict
forall c. Idea c => c -> IdeaDict
nw b
kind IdeaDict -> IdeaDict -> Sentence
`comb` a -> IdeaDict
forall c. Idea c => c -> IdeaDict
nw a
sys) (SepType -> FoldType -> [Sentence] -> Sentence
foldlList SepType
Comma FoldType
List ([Sentence] -> Sentence) -> [Sentence] -> Sentence
forall a b. (a -> b) -> a -> b
$ (c -> Sentence) -> [c] -> [Sentence]
forall a b. (a -> b) -> [a] -> [b]
map (String -> Sentence
S (String -> Sentence) -> (c -> String) -> c -> Sentence
forall b c a. (b -> c) -> (a -> b) -> a -> c
. c -> String
forall n. HasName n => n -> String
name) [c]
authors) ([DocSection] -> ShowTableOfContents
findToC [DocSection]
l) ([Section] -> Document) -> [Section] -> Document
forall a b. (a -> b) -> a -> b
$
SystemInformation -> [DocSection] -> [Section]
mkSections SystemInformation
fullSI [DocSection]
l where
fullSI :: SystemInformation
fullSI = SRSDecl -> SystemInformation -> SystemInformation
fillcdbSRS SRSDecl
dd SystemInformation
si
l :: [DocSection]
l = SystemInformation -> SRSDecl -> [DocSection]
mkDocDesc SystemInformation
fullSI SRSDecl
dd
fillcdbSRS :: SRSDecl -> SystemInformation -> SystemInformation
fillcdbSRS :: SRSDecl -> SystemInformation -> SystemInformation
fillcdbSRS srsDec :: SRSDecl
srsDec si :: SystemInformation
si = SRSDecl -> SystemInformation -> SystemInformation
fillSecAndLC SRSDecl
srsDec (SystemInformation -> SystemInformation)
-> SystemInformation -> SystemInformation
forall a b. (a -> b) -> a -> b
$ SRSDecl -> SystemInformation -> SystemInformation
fillReferences SRSDecl
srsDec (SystemInformation -> SystemInformation)
-> SystemInformation -> SystemInformation
forall a b. (a -> b) -> a -> b
$ SRSDecl -> SystemInformation -> SystemInformation
fillTraceSI SRSDecl
srsDec SystemInformation
si
fillSecAndLC :: SRSDecl -> SystemInformation -> SystemInformation
fillSecAndLC :: SRSDecl -> SystemInformation -> SystemInformation
fillSecAndLC dd :: SRSDecl
dd si :: SystemInformation
si = SystemInformation
si2
where
chkdb :: ChunkDB
chkdb = SystemInformation
si SystemInformation
-> Getting ChunkDB SystemInformation ChunkDB -> ChunkDB
forall s a. s -> Getting a s a -> a
^. Getting ChunkDB SystemInformation ChunkDB
Lens' SystemInformation ChunkDB
sysinfodb
allSections :: [Section]
allSections = (Section -> [Section]) -> [Section] -> [Section]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap Section -> [Section]
findAllSec ([Section] -> [Section]) -> [Section] -> [Section]
forall a b. (a -> b) -> a -> b
$ SystemInformation -> [DocSection] -> [Section]
mkSections SystemInformation
si ([DocSection] -> [Section]) -> [DocSection] -> [Section]
forall a b. (a -> b) -> a -> b
$ SystemInformation -> SRSDecl -> [DocSection]
mkDocDesc SystemInformation
si SRSDecl
dd
allLC :: [LabelledContent]
allLC = (Section -> [LabelledContent]) -> [Section] -> [LabelledContent]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap Section -> [LabelledContent]
findAllLC [Section]
allSections
existingSections :: [Section]
existingSections = ((UID, (Section, Int)) -> Section)
-> [(UID, (Section, Int))] -> [Section]
forall a b. (a -> b) -> [a] -> [b]
map ((Section, Int) -> Section
forall a b. (a, b) -> a
fst((Section, Int) -> Section)
-> ((UID, (Section, Int)) -> (Section, Int))
-> (UID, (Section, Int))
-> Section
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(UID, (Section, Int)) -> (Section, Int)
forall a b. (a, b) -> b
snd) ([(UID, (Section, Int))] -> [Section])
-> [(UID, (Section, Int))] -> [Section]
forall a b. (a -> b) -> a -> b
$ Map UID (Section, Int) -> [(UID, (Section, Int))]
forall k a. Map k a -> [(k, a)]
Map.assocs (Map UID (Section, Int) -> [(UID, (Section, Int))])
-> Map UID (Section, Int) -> [(UID, (Section, Int))]
forall a b. (a -> b) -> a -> b
$ ChunkDB
chkdb 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
existingLC :: [LabelledContent]
existingLC = ((UID, (LabelledContent, Int)) -> LabelledContent)
-> [(UID, (LabelledContent, Int))] -> [LabelledContent]
forall a b. (a -> b) -> [a] -> [b]
map ((LabelledContent, Int) -> LabelledContent
forall a b. (a, b) -> a
fst((LabelledContent, Int) -> LabelledContent)
-> ((UID, (LabelledContent, Int)) -> (LabelledContent, Int))
-> (UID, (LabelledContent, Int))
-> LabelledContent
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(UID, (LabelledContent, Int)) -> (LabelledContent, Int)
forall a b. (a, b) -> b
snd) ([(UID, (LabelledContent, Int))] -> [LabelledContent])
-> [(UID, (LabelledContent, Int))] -> [LabelledContent]
forall a b. (a -> b) -> a -> b
$ Map UID (LabelledContent, Int) -> [(UID, (LabelledContent, Int))]
forall k a. Map k a -> [(k, a)]
Map.assocs (Map UID (LabelledContent, Int) -> [(UID, (LabelledContent, Int))])
-> Map UID (LabelledContent, Int)
-> [(UID, (LabelledContent, Int))]
forall a b. (a -> b) -> a -> b
$ ChunkDB
chkdb 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
chkdb2 :: ChunkDB
chkdb2 = ASetter
ChunkDB
ChunkDB
(Map UID (LabelledContent, Int))
(Map UID (LabelledContent, Int))
-> Map UID (LabelledContent, Int) -> ChunkDB -> ChunkDB
forall s t a b. ASetter s t a b -> b -> s -> t
set ASetter
ChunkDB
ChunkDB
(Map UID (LabelledContent, Int))
(Map UID (LabelledContent, Int))
Lens' ChunkDB (Map UID (LabelledContent, Int))
labelledcontentTable ([LabelledContent] -> Map UID (LabelledContent, Int)
forall a. HasUID a => [a] -> Map UID (a, Int)
idMap ([LabelledContent] -> Map UID (LabelledContent, Int))
-> [LabelledContent] -> Map UID (LabelledContent, Int)
forall a b. (a -> b) -> a -> b
$ [LabelledContent] -> [LabelledContent]
forall a. Eq a => [a] -> [a]
nub ([LabelledContent] -> [LabelledContent])
-> [LabelledContent] -> [LabelledContent]
forall a b. (a -> b) -> a -> b
$ [LabelledContent]
existingLC [LabelledContent] -> [LabelledContent] -> [LabelledContent]
forall a. [a] -> [a] -> [a]
++ [LabelledContent]
allLC)
(ChunkDB -> ChunkDB) -> ChunkDB -> ChunkDB
forall a b. (a -> b) -> a -> b
$ ASetter
ChunkDB ChunkDB (Map UID (Section, Int)) (Map UID (Section, Int))
-> Map UID (Section, Int) -> ChunkDB -> ChunkDB
forall s t a b. ASetter s t a b -> b -> s -> t
set ASetter
ChunkDB ChunkDB (Map UID (Section, Int)) (Map UID (Section, Int))
Lens' ChunkDB (Map UID (Section, Int))
sectionTable ([Section] -> Map UID (Section, Int)
forall a. HasUID a => [a] -> Map UID (a, Int)
idMap ([Section] -> Map UID (Section, Int))
-> [Section] -> Map UID (Section, Int)
forall a b. (a -> b) -> a -> b
$ [Section] -> [Section]
forall a. Eq a => [a] -> [a]
nub ([Section] -> [Section]) -> [Section] -> [Section]
forall a b. (a -> b) -> a -> b
$ [Section]
existingSections [Section] -> [Section] -> [Section]
forall a. [a] -> [a] -> [a]
++ [Section]
allSections) ChunkDB
chkdb
si2 :: SystemInformation
si2 = ASetter SystemInformation SystemInformation ChunkDB ChunkDB
-> ChunkDB -> SystemInformation -> SystemInformation
forall s t a b. ASetter s t a b -> b -> s -> t
set ASetter SystemInformation SystemInformation ChunkDB ChunkDB
Lens' SystemInformation ChunkDB
sysinfodb ChunkDB
chkdb2 SystemInformation
si
findAllSec :: Section -> [Section]
findAllSec :: Section -> [Section]
findAllSec s :: Section
s@(Section _ cs :: [SecCons]
cs _) = Section
s Section -> [Section] -> [Section]
forall a. a -> [a] -> [a]
: (SecCons -> [Section]) -> [SecCons] -> [Section]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap SecCons -> [Section]
findAllSubSec [SecCons]
cs
findAllSubSec :: SecCons -> [Section]
findAllSubSec :: SecCons -> [Section]
findAllSubSec (Sub s :: Section
s) = Section -> [Section]
findAllSec Section
s
findAllSubSec _ = []
findAllLC :: Section -> [LabelledContent]
findAllLC :: Section -> [LabelledContent]
findAllLC (Section _ cs :: [SecCons]
cs _) = (SecCons -> [LabelledContent]) -> [SecCons] -> [LabelledContent]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap SecCons -> [LabelledContent]
findLCSecCons [SecCons]
cs
findLCSecCons :: SecCons -> [LabelledContent]
findLCSecCons :: SecCons -> [LabelledContent]
findLCSecCons (Sub s :: Section
s) = Section -> [LabelledContent]
findAllLC Section
s
findLCSecCons (Con (LlC lblcons :: LabelledContent
lblcons)) = [LabelledContent
lblcons]
findLCSecCons _ = []
fillReferences :: SRSDecl -> SystemInformation -> SystemInformation
fillReferences :: SRSDecl -> SystemInformation -> SystemInformation
fillReferences dd :: SRSDecl
dd si :: SystemInformation
si@SI{_sys :: ()
_sys = a
sys} = SystemInformation
si2
where
chkdb :: ChunkDB
chkdb = SystemInformation
si SystemInformation
-> Getting ChunkDB SystemInformation ChunkDB -> ChunkDB
forall s a. s -> Getting a s a -> a
^. Getting ChunkDB SystemInformation ChunkDB
Lens' SystemInformation ChunkDB
sysinfodb
rfdb :: ReferenceDB
rfdb = SystemInformation -> ReferenceDB
refdb SystemInformation
si
allSections :: [Section]
allSections = SystemInformation -> [DocSection] -> [Section]
mkSections SystemInformation
si ([DocSection] -> [Section]) -> [DocSection] -> [Section]
forall a b. (a -> b) -> a -> b
$ SystemInformation -> SRSDecl -> [DocSection]
mkDocDesc SystemInformation
si SRSDecl
dd
refsFromSRS :: [Reference]
refsFromSRS = (Section -> [Reference]) -> [Section] -> [Reference]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap Section -> [Reference]
findAllRefs [Section]
allSections
inRefs :: [Reference]
inRefs = (DataDefinition -> [Reference]) -> [DataDefinition] -> [Reference]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap DataDefinition -> [Reference]
forall a. HasDecRef a => a -> [Reference]
dRefToRef [DataDefinition]
ddefs [Reference] -> [Reference] -> [Reference]
forall a. [a] -> [a] -> [a]
++ (GenDefn -> [Reference]) -> [GenDefn] -> [Reference]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap GenDefn -> [Reference]
forall a. HasDecRef a => a -> [Reference]
dRefToRef [GenDefn]
gdefs [Reference] -> [Reference] -> [Reference]
forall a. [a] -> [a] -> [a]
++ (InstanceModel -> [Reference]) -> [InstanceModel] -> [Reference]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap InstanceModel -> [Reference]
forall a. HasDecRef a => a -> [Reference]
dRefToRef [InstanceModel]
imods [Reference] -> [Reference] -> [Reference]
forall a. [a] -> [a] -> [a]
++ (TheoryModel -> [Reference]) -> [TheoryModel] -> [Reference]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap TheoryModel -> [Reference]
forall a. HasDecRef a => a -> [Reference]
dRefToRef [TheoryModel]
tmods
ddefs :: [DataDefinition]
ddefs = ((UID, (DataDefinition, Int)) -> DataDefinition)
-> [(UID, (DataDefinition, Int))] -> [DataDefinition]
forall a b. (a -> b) -> [a] -> [b]
map ((DataDefinition, Int) -> DataDefinition
forall a b. (a, b) -> a
fst((DataDefinition, Int) -> DataDefinition)
-> ((UID, (DataDefinition, Int)) -> (DataDefinition, Int))
-> (UID, (DataDefinition, Int))
-> DataDefinition
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(UID, (DataDefinition, Int)) -> (DataDefinition, Int)
forall a b. (a, b) -> b
snd) ([(UID, (DataDefinition, Int))] -> [DataDefinition])
-> [(UID, (DataDefinition, Int))] -> [DataDefinition]
forall a b. (a -> b) -> a -> b
$ Map UID (DataDefinition, Int) -> [(UID, (DataDefinition, Int))]
forall k a. Map k a -> [(k, a)]
Map.assocs (Map UID (DataDefinition, Int) -> [(UID, (DataDefinition, Int))])
-> Map UID (DataDefinition, Int) -> [(UID, (DataDefinition, Int))]
forall a b. (a -> b) -> a -> b
$ ChunkDB
chkdb 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
gdefs :: [GenDefn]
gdefs = ((UID, (GenDefn, Int)) -> GenDefn)
-> [(UID, (GenDefn, Int))] -> [GenDefn]
forall a b. (a -> b) -> [a] -> [b]
map ((GenDefn, Int) -> GenDefn
forall a b. (a, b) -> a
fst((GenDefn, Int) -> GenDefn)
-> ((UID, (GenDefn, Int)) -> (GenDefn, Int))
-> (UID, (GenDefn, Int))
-> GenDefn
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(UID, (GenDefn, Int)) -> (GenDefn, Int)
forall a b. (a, b) -> b
snd) ([(UID, (GenDefn, Int))] -> [GenDefn])
-> [(UID, (GenDefn, Int))] -> [GenDefn]
forall a b. (a -> b) -> a -> b
$ Map UID (GenDefn, Int) -> [(UID, (GenDefn, Int))]
forall k a. Map k a -> [(k, a)]
Map.assocs (Map UID (GenDefn, Int) -> [(UID, (GenDefn, Int))])
-> Map UID (GenDefn, Int) -> [(UID, (GenDefn, Int))]
forall a b. (a -> b) -> a -> b
$ ChunkDB
chkdb 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
imods :: [InstanceModel]
imods = ((UID, (InstanceModel, Int)) -> InstanceModel)
-> [(UID, (InstanceModel, Int))] -> [InstanceModel]
forall a b. (a -> b) -> [a] -> [b]
map ((InstanceModel, Int) -> InstanceModel
forall a b. (a, b) -> a
fst((InstanceModel, Int) -> InstanceModel)
-> ((UID, (InstanceModel, Int)) -> (InstanceModel, Int))
-> (UID, (InstanceModel, Int))
-> InstanceModel
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(UID, (InstanceModel, Int)) -> (InstanceModel, Int)
forall a b. (a, b) -> b
snd) ([(UID, (InstanceModel, Int))] -> [InstanceModel])
-> [(UID, (InstanceModel, Int))] -> [InstanceModel]
forall a b. (a -> b) -> a -> b
$ Map UID (InstanceModel, Int) -> [(UID, (InstanceModel, Int))]
forall k a. Map k a -> [(k, a)]
Map.assocs (Map UID (InstanceModel, Int) -> [(UID, (InstanceModel, Int))])
-> Map UID (InstanceModel, Int) -> [(UID, (InstanceModel, Int))]
forall a b. (a -> b) -> a -> b
$ ChunkDB
chkdb 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
tmods :: [TheoryModel]
tmods = ((UID, (TheoryModel, Int)) -> TheoryModel)
-> [(UID, (TheoryModel, Int))] -> [TheoryModel]
forall a b. (a -> b) -> [a] -> [b]
map ((TheoryModel, Int) -> TheoryModel
forall a b. (a, b) -> a
fst((TheoryModel, Int) -> TheoryModel)
-> ((UID, (TheoryModel, Int)) -> (TheoryModel, Int))
-> (UID, (TheoryModel, Int))
-> TheoryModel
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(UID, (TheoryModel, Int)) -> (TheoryModel, Int)
forall a b. (a, b) -> b
snd) ([(UID, (TheoryModel, Int))] -> [TheoryModel])
-> [(UID, (TheoryModel, Int))] -> [TheoryModel]
forall a b. (a -> b) -> a -> b
$ Map UID (TheoryModel, Int) -> [(UID, (TheoryModel, Int))]
forall k a. Map k a -> [(k, a)]
Map.assocs (Map UID (TheoryModel, Int) -> [(UID, (TheoryModel, Int))])
-> Map UID (TheoryModel, Int) -> [(UID, (TheoryModel, Int))]
forall a b. (a -> b) -> a -> b
$ ChunkDB
chkdb 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
concIns :: [ConceptInstance]
concIns = ((UID, (ConceptInstance, Int)) -> ConceptInstance)
-> [(UID, (ConceptInstance, Int))] -> [ConceptInstance]
forall a b. (a -> b) -> [a] -> [b]
map ((ConceptInstance, Int) -> ConceptInstance
forall a b. (a, b) -> a
fst((ConceptInstance, Int) -> ConceptInstance)
-> ((UID, (ConceptInstance, Int)) -> (ConceptInstance, Int))
-> (UID, (ConceptInstance, Int))
-> ConceptInstance
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(UID, (ConceptInstance, Int)) -> (ConceptInstance, Int)
forall a b. (a, b) -> b
snd) ([(UID, (ConceptInstance, Int))] -> [ConceptInstance])
-> [(UID, (ConceptInstance, Int))] -> [ConceptInstance]
forall a b. (a -> b) -> a -> b
$ Map UID (ConceptInstance, Int) -> [(UID, (ConceptInstance, Int))]
forall k a. Map k a -> [(k, a)]
Map.assocs (Map UID (ConceptInstance, Int) -> [(UID, (ConceptInstance, Int))])
-> Map UID (ConceptInstance, Int)
-> [(UID, (ConceptInstance, Int))]
forall a b. (a -> b) -> a -> b
$ ChunkDB
chkdb 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
secs :: [Section]
secs = ((UID, (Section, Int)) -> Section)
-> [(UID, (Section, Int))] -> [Section]
forall a b. (a -> b) -> [a] -> [b]
map ((Section, Int) -> Section
forall a b. (a, b) -> a
fst((Section, Int) -> Section)
-> ((UID, (Section, Int)) -> (Section, Int))
-> (UID, (Section, Int))
-> Section
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(UID, (Section, Int)) -> (Section, Int)
forall a b. (a, b) -> b
snd) ([(UID, (Section, Int))] -> [Section])
-> [(UID, (Section, Int))] -> [Section]
forall a b. (a -> b) -> a -> b
$ Map UID (Section, Int) -> [(UID, (Section, Int))]
forall k a. Map k a -> [(k, a)]
Map.assocs (Map UID (Section, Int) -> [(UID, (Section, Int))])
-> Map UID (Section, Int) -> [(UID, (Section, Int))]
forall a b. (a -> b) -> a -> b
$ ChunkDB
chkdb 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
lblCon :: [LabelledContent]
lblCon = ((UID, (LabelledContent, Int)) -> LabelledContent)
-> [(UID, (LabelledContent, Int))] -> [LabelledContent]
forall a b. (a -> b) -> [a] -> [b]
map ((LabelledContent, Int) -> LabelledContent
forall a b. (a, b) -> a
fst((LabelledContent, Int) -> LabelledContent)
-> ((UID, (LabelledContent, Int)) -> (LabelledContent, Int))
-> (UID, (LabelledContent, Int))
-> LabelledContent
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(UID, (LabelledContent, Int)) -> (LabelledContent, Int)
forall a b. (a, b) -> b
snd) ([(UID, (LabelledContent, Int))] -> [LabelledContent])
-> [(UID, (LabelledContent, Int))] -> [LabelledContent]
forall a b. (a -> b) -> a -> b
$ Map UID (LabelledContent, Int) -> [(UID, (LabelledContent, Int))]
forall k a. Map k a -> [(k, a)]
Map.assocs (Map UID (LabelledContent, Int) -> [(UID, (LabelledContent, Int))])
-> Map UID (LabelledContent, Int)
-> [(UID, (LabelledContent, Int))]
forall a b. (a -> b) -> a -> b
$ ChunkDB
chkdb 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
cites :: BibRef
cites = SystemInformation -> BibRef
citeDB SystemInformation
si
conins :: [ConceptInstance]
conins = ((UID, (ConceptInstance, Int)) -> ConceptInstance)
-> [(UID, (ConceptInstance, Int))] -> [ConceptInstance]
forall a b. (a -> b) -> [a] -> [b]
map ((ConceptInstance, Int) -> ConceptInstance
forall a b. (a, b) -> a
fst((ConceptInstance, Int) -> ConceptInstance)
-> ((UID, (ConceptInstance, Int)) -> (ConceptInstance, Int))
-> (UID, (ConceptInstance, Int))
-> ConceptInstance
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(UID, (ConceptInstance, Int)) -> (ConceptInstance, Int)
forall a b. (a, b) -> b
snd) ([(UID, (ConceptInstance, Int))] -> [ConceptInstance])
-> [(UID, (ConceptInstance, Int))] -> [ConceptInstance]
forall a b. (a -> b) -> a -> b
$ Map UID (ConceptInstance, Int) -> [(UID, (ConceptInstance, Int))]
forall k a. Map k a -> [(k, a)]
Map.assocs (Map UID (ConceptInstance, Int) -> [(UID, (ConceptInstance, Int))])
-> Map UID (ConceptInstance, Int)
-> [(UID, (ConceptInstance, Int))]
forall a b. (a -> b) -> a -> b
$ ReferenceDB
rfdb ReferenceDB
-> Getting
(Map UID (ConceptInstance, Int))
ReferenceDB
(Map UID (ConceptInstance, Int))
-> Map UID (ConceptInstance, Int)
forall s a. s -> Getting a s a -> a
^. Getting
(Map UID (ConceptInstance, Int))
ReferenceDB
(Map UID (ConceptInstance, Int))
Lens' ReferenceDB (Map UID (ConceptInstance, Int))
conceptDB
refs :: [Reference]
refs = ((UID, (Reference, Int)) -> Reference)
-> [(UID, (Reference, Int))] -> [Reference]
forall a b. (a -> b) -> [a] -> [b]
map ((Reference, Int) -> Reference
forall a b. (a, b) -> a
fst((Reference, Int) -> Reference)
-> ((UID, (Reference, Int)) -> (Reference, Int))
-> (UID, (Reference, Int))
-> Reference
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(UID, (Reference, Int)) -> (Reference, Int)
forall a b. (a, b) -> b
snd) ([(UID, (Reference, Int))] -> [Reference])
-> [(UID, (Reference, Int))] -> [Reference]
forall a b. (a -> b) -> a -> b
$ Map UID (Reference, Int) -> [(UID, (Reference, Int))]
forall k a. Map k a -> [(k, a)]
Map.assocs (Map UID (Reference, Int) -> [(UID, (Reference, Int))])
-> Map UID (Reference, Int) -> [(UID, (Reference, Int))]
forall a b. (a -> b) -> a -> b
$ ChunkDB
chkdb ChunkDB
-> Getting
(Map UID (Reference, Int)) ChunkDB (Map UID (Reference, Int))
-> Map UID (Reference, Int)
forall s a. s -> Getting a s a -> a
^. Getting
(Map UID (Reference, Int)) ChunkDB (Map UID (Reference, Int))
Lens' ChunkDB (Map UID (Reference, Int))
refTable
chkdb2 :: ChunkDB
chkdb2 = ASetter
ChunkDB
ChunkDB
(Map UID (Reference, Int))
(Map UID (Reference, Int))
-> Map UID (Reference, Int) -> ChunkDB -> ChunkDB
forall s t a b. ASetter s t a b -> b -> s -> t
set ASetter
ChunkDB
ChunkDB
(Map UID (Reference, Int))
(Map UID (Reference, Int))
Lens' ChunkDB (Map UID (Reference, Int))
refTable ([Reference] -> Map UID (Reference, Int)
forall a. HasUID a => [a] -> Map UID (a, Int)
idMap ([Reference] -> Map UID (Reference, Int))
-> [Reference] -> Map UID (Reference, Int)
forall a b. (a -> b) -> a -> b
$ [Reference] -> [Reference]
forall a. Eq a => [a] -> [a]
nub ([Reference] -> [Reference]) -> [Reference] -> [Reference]
forall a b. (a -> b) -> a -> b
$ [Reference]
refsFromSRS [Reference] -> [Reference] -> [Reference]
forall a. [a] -> [a] -> [a]
++ [Reference]
inRefs
[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) (SystemInformation -> [TraceConfig]
traceMatStandard SystemInformation
si) [Reference] -> [Reference] -> [Reference]
forall a. [a] -> [a] -> [a]
++ [Reference]
secRefs
[Reference] -> [Reference] -> [Reference]
forall a. [a] -> [a] -> [a]
++ String -> [Reference]
traceyGraphGetRefs ((Char -> Bool) -> String -> String
forall a. (a -> Bool) -> [a] -> [a]
filter (Bool -> Bool
not(Bool -> Bool) -> (Char -> Bool) -> Char -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
.Char -> Bool
isSpace) (String -> String) -> String -> String
forall a b. (a -> b) -> a -> b
$ a -> String
forall c. CommonIdea c => c -> String
abrv 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]
++ (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]
conins [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]
++ (Section -> Reference) -> [Section] -> [Reference]
forall a b. (a -> b) -> [a] -> [b]
map Section -> Reference
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Reference
ref [Section]
secs [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
[Reference] -> [Reference] -> [Reference]
forall a. [a] -> [a] -> [a]
++ [Reference]
refs) ChunkDB
chkdb
si2 :: SystemInformation
si2 = ASetter SystemInformation SystemInformation ChunkDB ChunkDB
-> ChunkDB -> SystemInformation -> SystemInformation
forall s t a b. ASetter s t a b -> b -> s -> t
set ASetter SystemInformation SystemInformation ChunkDB ChunkDB
Lens' SystemInformation ChunkDB
sysinfodb ChunkDB
chkdb2 SystemInformation
si
dRefToRef :: HasDecRef a => a -> [Reference]
dRefToRef :: a -> [Reference]
dRefToRef r :: a
r = (DecRef -> Reference) -> [DecRef] -> [Reference]
forall a b. (a -> b) -> [a] -> [b]
map DecRef -> Reference
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Reference
ref ([DecRef] -> [Reference]) -> [DecRef] -> [Reference]
forall a b. (a -> b) -> a -> b
$ a
r a -> Getting [DecRef] a [DecRef] -> [DecRef]
forall s a. s -> Getting a s a -> a
^. Getting [DecRef] a [DecRef]
forall c. HasDecRef c => Lens' c [DecRef]
getDecRefs
findAllRefs :: Section -> [Reference]
findAllRefs :: Section -> [Reference]
findAllRefs (Section _ cs :: [SecCons]
cs r :: Reference
r) = Reference
rReference -> [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 s :: Section
s) = Section -> [Reference]
findAllRefs Section
s
findRefSecCons (Con (LlC (LblC rf :: Reference
rf _))) = [Reference
rf]
findRefSecCons _ = []
fillTraceSI :: SRSDecl -> SystemInformation -> SystemInformation
fillTraceSI :: SRSDecl -> SystemInformation -> SystemInformation
fillTraceSI dd :: SRSDecl
dd si :: SystemInformation
si = [DocSection] -> SystemInformation -> SystemInformation
fillTraceMaps [DocSection]
l (SystemInformation -> SystemInformation)
-> SystemInformation -> SystemInformation
forall a b. (a -> b) -> a -> b
$ [DocSection] -> SystemInformation -> SystemInformation
fillReqs [DocSection]
l SystemInformation
si
where
l :: [DocSection]
l = SystemInformation -> SRSDecl -> [DocSection]
mkDocDesc SystemInformation
si SRSDecl
dd
fillTraceMaps :: DocDesc -> SystemInformation -> SystemInformation
fillTraceMaps :: [DocSection] -> SystemInformation -> SystemInformation
fillTraceMaps dd :: [DocSection]
dd si :: SystemInformation
si@SI{_sysinfodb :: SystemInformation -> ChunkDB
_sysinfodb = ChunkDB
db} = SystemInformation
si {_sysinfodb :: ChunkDB
_sysinfodb =
ASetter ChunkDB ChunkDB RefbyMap RefbyMap
-> RefbyMap -> ChunkDB -> ChunkDB
forall s t a b. ASetter s t a b -> b -> s -> t
set ASetter ChunkDB ChunkDB RefbyMap RefbyMap
Lens' ChunkDB RefbyMap
refbyTable (RefbyMap -> RefbyMap
generateRefbyMap RefbyMap
tdb) (ChunkDB -> ChunkDB) -> ChunkDB -> ChunkDB
forall a b. (a -> b) -> a -> b
$ ASetter ChunkDB ChunkDB RefbyMap RefbyMap
-> RefbyMap -> ChunkDB -> ChunkDB
forall s t a b. ASetter s t a b -> b -> s -> t
set ASetter ChunkDB ChunkDB RefbyMap RefbyMap
Lens' ChunkDB RefbyMap
traceTable RefbyMap
tdb ChunkDB
db} where
tdb :: RefbyMap
tdb = [DocSection] -> RefbyMap
generateTraceMap [DocSection]
dd
fillReqs :: DocDesc -> SystemInformation -> SystemInformation
fillReqs :: [DocSection] -> SystemInformation -> SystemInformation
fillReqs [] si :: SystemInformation
si = SystemInformation
si
fillReqs (ReqrmntSec (ReqsProg x :: [ReqsSub]
x):_) si :: SystemInformation
si@SI{_sysinfodb :: SystemInformation -> ChunkDB
_sysinfodb = ChunkDB
db} = [ReqsSub] -> SystemInformation
genReqs [ReqsSub]
x
where
genReqs :: [ReqsSub] -> SystemInformation
genReqs [] = SystemInformation
si
genReqs (FReqsSub c :: [ConceptInstance]
c _:_) = SystemInformation
si {_sysinfodb :: ChunkDB
_sysinfodb = ASetter
ChunkDB
ChunkDB
(Map UID (ConceptInstance, Int))
(Map UID (ConceptInstance, Int))
-> Map UID (ConceptInstance, Int) -> ChunkDB -> ChunkDB
forall s t a b. ASetter s t a b -> b -> s -> t
set ASetter
ChunkDB
ChunkDB
(Map UID (ConceptInstance, Int))
(Map UID (ConceptInstance, Int))
Lens' ChunkDB (Map UID (ConceptInstance, Int))
conceptinsTable Map UID (ConceptInstance, Int)
newCI ChunkDB
db} where
newCI :: Map UID (ConceptInstance, Int)
newCI = [ConceptInstance] -> Map UID (ConceptInstance, Int)
forall a. HasUID a => [a] -> Map UID (a, Int)
idMap ([ConceptInstance] -> Map UID (ConceptInstance, Int))
-> [ConceptInstance] -> Map UID (ConceptInstance, Int)
forall a b. (a -> b) -> a -> b
$ [ConceptInstance] -> [ConceptInstance]
forall a. Eq a => [a] -> [a]
nub ([ConceptInstance] -> [ConceptInstance])
-> [ConceptInstance] -> [ConceptInstance]
forall a b. (a -> b) -> a -> b
$ [ConceptInstance]
c [ConceptInstance] -> [ConceptInstance] -> [ConceptInstance]
forall a. [a] -> [a] -> [a]
++ ((ConceptInstance, Int) -> ConceptInstance)
-> [(ConceptInstance, Int)] -> [ConceptInstance]
forall a b. (a -> b) -> [a] -> [b]
map (ConceptInstance, Int) -> ConceptInstance
forall a b. (a, b) -> a
fst (((ConceptInstance, Int) -> Int)
-> [(ConceptInstance, Int)] -> [(ConceptInstance, Int)]
forall b a. Ord b => (a -> b) -> [a] -> [a]
sortOn (ConceptInstance, Int) -> Int
forall a b. (a, b) -> b
snd ([(ConceptInstance, Int)] -> [(ConceptInstance, Int)])
-> [(ConceptInstance, Int)] -> [(ConceptInstance, Int)]
forall a b. (a -> b) -> a -> b
$ ((UID, (ConceptInstance, Int)) -> (ConceptInstance, Int))
-> [(UID, (ConceptInstance, Int))] -> [(ConceptInstance, Int)]
forall a b. (a -> b) -> [a] -> [b]
map (UID, (ConceptInstance, Int)) -> (ConceptInstance, Int)
forall a b. (a, b) -> b
snd ([(UID, (ConceptInstance, Int))] -> [(ConceptInstance, Int)])
-> [(UID, (ConceptInstance, Int))] -> [(ConceptInstance, Int)]
forall a b. (a -> b) -> a -> b
$ Map UID (ConceptInstance, Int) -> [(UID, (ConceptInstance, Int))]
forall k a. Map k a -> [(k, a)]
Map.toList (Map UID (ConceptInstance, Int) -> [(UID, (ConceptInstance, Int))])
-> Map UID (ConceptInstance, Int)
-> [(UID, (ConceptInstance, Int))]
forall a b. (a -> b) -> a -> b
$ ChunkDB
db 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)
genReqs (_:xs :: [ReqsSub]
xs) = [ReqsSub] -> SystemInformation
genReqs [ReqsSub]
xs
fillReqs (_:xs :: [DocSection]
xs) si :: SystemInformation
si = [DocSection] -> SystemInformation -> SystemInformation
fillReqs [DocSection]
xs SystemInformation
si
extractUnits :: DocDesc -> ChunkDB -> [UnitDefn]
dd :: [DocSection]
dd cdb :: ChunkDB
cdb = ChunkDB -> [QuantityDict] -> [UnitDefn]
forall c. Quantity c => ChunkDB -> [c] -> [UnitDefn]
collectUnits ChunkDB
cdb ([QuantityDict] -> [UnitDefn]) -> [QuantityDict] -> [UnitDefn]
forall a b. (a -> b) -> a -> b
$ [Sentence] -> [ModelExpr] -> ChunkDB -> [QuantityDict]
ccss' ([DocSection] -> [Sentence]
getDocDesc [DocSection]
dd) ([DocSection] -> [ModelExpr]
egetDocDesc [DocSection]
dd) ChunkDB
cdb
mkSections :: SystemInformation -> DocDesc -> [Section]
mkSections :: SystemInformation -> [DocSection] -> [Section]
mkSections si :: SystemInformation
si dd :: [DocSection]
dd = (DocSection -> Section) -> [DocSection] -> [Section]
forall a b. (a -> b) -> [a] -> [b]
map DocSection -> Section
doit [DocSection]
dd
where
doit :: DocSection -> Section
doit :: DocSection -> Section
doit TableOfContents = [DocSection] -> Section
mkToC [DocSection]
dd
doit (RefSec rs :: RefSec
rs) = SystemInformation -> [DocSection] -> RefSec -> Section
mkRefSec SystemInformation
si [DocSection]
dd RefSec
rs
doit (IntroSec is :: IntroSec
is) = SystemInformation -> IntroSec -> Section
mkIntroSec SystemInformation
si IntroSec
is
doit (StkhldrSec sts :: StkhldrSec
sts) = StkhldrSec -> Section
mkStkhldrSec StkhldrSec
sts
doit (SSDSec ss :: SSDSec
ss) = SystemInformation -> SSDSec -> Section
mkSSDSec SystemInformation
si SSDSec
ss
doit (AuxConstntSec acs :: AuxConstntSec
acs) = AuxConstntSec -> Section
mkAuxConsSec AuxConstntSec
acs
doit Bibliography = BibRef -> Section
mkBib (SystemInformation -> BibRef
citeDB SystemInformation
si)
doit (GSDSec gs' :: GSDSec
gs') = GSDSec -> Section
mkGSDSec GSDSec
gs'
doit (ReqrmntSec r :: ReqrmntSec
r) = ReqrmntSec -> Section
mkReqrmntSec ReqrmntSec
r
doit (LCsSec lc :: LCsSec
lc) = LCsSec -> Section
mkLCsSec LCsSec
lc
doit (UCsSec ulcs :: UCsSec
ulcs) = UCsSec -> Section
mkUCsSec UCsSec
ulcs
doit (TraceabilitySec t :: TraceabilitySec
t) = TraceabilitySec -> SystemInformation -> Section
mkTraceabilitySec TraceabilitySec
t SystemInformation
si
doit (AppndxSec a :: AppndxSec
a) = AppndxSec -> Section
mkAppndxSec AppndxSec
a
doit (OffShelfSolnsSec o :: OffShelfSolnsSec
o) = OffShelfSolnsSec -> Section
mkOffShelfSolnSec OffShelfSolnsSec
o
mkToC :: DocDesc -> Section
mkToC :: [DocSection] -> Section
mkToC dd :: [DocSection]
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))
-> [DocSection] -> [(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) [DocSection]
dd] []
where
intro :: Contents
intro = Sentence -> Contents
mkParagraph (Sentence -> Contents) -> Sentence -> Contents
forall a b. (a -> b) -> a -> b
$ String -> Sentence
S "An outline of all sections included in this SRS is recorded here for easy reference."
mkRefSec :: SystemInformation -> DocDesc -> RefSec -> Section
mkRefSec :: SystemInformation -> [DocSection] -> RefSec -> Section
mkRefSec si :: SystemInformation
si dd :: [DocSection]
dd (RefProg c :: Contents
c l :: [RefTab]
l) = [Contents] -> [Section] -> Section
SRS.refMat [Contents
c] ((RefTab -> Section) -> [RefTab] -> [Section]
forall a b. (a -> b) -> [a] -> [b]
map (SystemInformation -> RefTab -> Section
mkSubRef SystemInformation
si) [RefTab]
l)
where
mkSubRef :: SystemInformation -> RefTab -> Section
mkSubRef :: SystemInformation -> RefTab -> Section
mkSubRef si' :: SystemInformation
si' TUnits = SystemInformation -> RefTab -> Section
mkSubRef SystemInformation
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 {_sysinfodb :: SystemInformation -> ChunkDB
_sysinfodb = ChunkDB
db} (TUnits' con :: [TUIntro]
con f :: [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
$ [DocSection] -> ChunkDB -> [UnitDefn]
extractUnits [DocSection]
dd ChunkDB
db)] []
mkSubRef SI {_quants :: ()
_quants = [e]
v, _sysinfodb :: SystemInformation -> ChunkDB
_sysinfodb = ChunkDB
cdb} (TSymb con :: [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
-> [QuantityDict] -> (QuantityDict -> Sentence) -> LabelledContent
forall s.
(Quantity s, MayHaveUnit s) =>
Stage -> [s] -> (s -> Sentence) -> LabelledContent
table Stage
Equational ([QuantityDict] -> [QuantityDict]
forall a. HasSymbol a => [a] -> [a]
sortBySymbol
([QuantityDict] -> [QuantityDict])
-> [QuantityDict] -> [QuantityDict]
forall a b. (a -> b) -> a -> b
$ (QuantityDict -> Bool) -> [QuantityDict] -> [QuantityDict]
forall a. (a -> Bool) -> [a] -> [a]
filter (QuantityDict -> Stage -> Bool
forall q. HasSymbol q => q -> Stage -> Bool
`hasStageSymbol` Stage
Equational)
([QuantityDict] -> [QuantityDict]
forall a. Eq a => [a] -> [a]
nub ([QuantityDict] -> [QuantityDict])
-> [QuantityDict] -> [QuantityDict]
forall a b. (a -> b) -> a -> b
$ (e -> QuantityDict) -> [e] -> [QuantityDict]
forall a b. (a -> b) -> [a] -> [b]
map e -> QuantityDict
forall q. (Quantity q, MayHaveUnit q) => q -> QuantityDict
qw [e]
v [QuantityDict] -> [QuantityDict] -> [QuantityDict]
forall a. [a] -> [a] -> [a]
++ [Sentence] -> [ModelExpr] -> ChunkDB -> [QuantityDict]
ccss' ([DocSection] -> [Sentence]
getDocDesc [DocSection]
dd) ([DocSection] -> [ModelExpr]
egetDocDesc [DocSection]
dd) ChunkDB
cdb))
QuantityDict -> Sentence
forall n. NamedIdea n => n -> Sentence
atStart] []
mkSubRef SI {_sysinfodb :: SystemInformation -> ChunkDB
_sysinfodb = ChunkDB
cdb} (TSymb' f :: LFunc
f con :: [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 ([DocSection] -> [Sentence]
getDocDesc [DocSection]
dd) ([DocSection] -> [ModelExpr]
egetDocDesc [DocSection]
dd) ChunkDB
cdb) LFunc
f [TSIntro]
con
mkSubRef SI {_usedinfodb :: SystemInformation -> ChunkDB
_usedinfodb = ChunkDB
db} TAandA =
[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] -> [IdeaDict]) -> [IdeaDict] -> [IdeaDict]
forall a b. (a -> b) -> a -> b
$ ((IdeaDict, Int) -> IdeaDict) -> [(IdeaDict, Int)] -> [IdeaDict]
forall a b. (a -> b) -> [a] -> [b]
map (IdeaDict, Int) -> IdeaDict
forall a b. (a, b) -> a
fst ([(IdeaDict, Int)] -> [IdeaDict])
-> [(IdeaDict, Int)] -> [IdeaDict]
forall a b. (a -> b) -> a -> b
$ Map UID (IdeaDict, Int) -> [(IdeaDict, Int)]
forall k a. Map k a -> [a]
Map.elems (Map UID (IdeaDict, Int) -> [(IdeaDict, Int)])
-> Map UID (IdeaDict, Int) -> [(IdeaDict, Int)]
forall a b. (a -> b) -> a -> b
$ ChunkDB -> Map UID (IdeaDict, Int)
termTable ChunkDB
db] []
mkTSymb :: (Quantity e, Concept e, Eq e, MayHaveUnit e) =>
[e] -> LFunc -> [TSIntro] -> Section
mkTSymb :: [e] -> LFunc -> [TSIntro] -> Section
mkTSymb v :: [e]
v f :: LFunc
f c :: [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 s. (NamedIdea s, Definition s) => LFunc -> s -> Sentence
lf LFunc
f)]
[]
where lf :: LFunc -> s -> Sentence
lf Term = s -> Sentence
forall n. NamedIdea n => n -> Sentence
atStart
lf Defn = Sentence -> Sentence
capSent (Sentence -> Sentence) -> (s -> Sentence) -> s -> Sentence
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (s -> Getting Sentence s Sentence -> Sentence
forall s a. s -> Getting a s a -> a
^. Getting Sentence s Sentence
forall c. Definition c => Lens' c Sentence
defn)
lf (TermExcept cs :: [DefinedQuantityDict]
cs) = \x :: s
x -> if (s
x s -> Getting UID s UID -> UID
forall s a. s -> Getting a s a -> a
^. Getting UID s UID
forall c. HasUID c => Lens' c UID
uid) UID -> [UID] -> 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 => Lens' c UID
uid) [DefinedQuantityDict]
cs then
Sentence -> Sentence
capSent (s
x s -> Getting Sentence s Sentence -> Sentence
forall s a. s -> Getting a s a -> a
^. Getting Sentence s Sentence
forall c. Definition c => Lens' c Sentence
defn) else s -> Sentence
forall n. NamedIdea n => n -> Sentence
atStart s
x
lf (DefnExcept cs :: [DefinedQuantityDict]
cs) = \x :: s
x -> if (s
x s -> Getting UID s UID -> UID
forall s a. s -> Getting a s a -> a
^. Getting UID s UID
forall c. HasUID c => Lens' c UID
uid) UID -> [UID] -> 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 => Lens' c UID
uid) [DefinedQuantityDict]
cs then
s -> Sentence
forall n. NamedIdea n => n -> Sentence
atStart s
x else Sentence -> Sentence
capSent (s
x s -> Getting Sentence s Sentence -> Sentence
forall s a. s -> Getting a s a -> a
^. Getting Sentence s Sentence
forall c. Definition c => Lens' c Sentence
defn)
lf TAD = \tDef :: s
tDef -> s -> Sentence
forall n. NamedIdea n => n -> Sentence
titleize s
tDef Sentence -> Sentence -> Sentence
+: Sentence
EmptyS Sentence -> Sentence -> Sentence
+:+. Sentence -> Sentence
capSent (s
tDef s -> Getting Sentence s Sentence -> Sentence
forall s a. s -> Getting a s a -> a
^. Getting Sentence s Sentence
forall c. Definition c => Lens' c Sentence
defn)
mkIntroSec :: SystemInformation -> IntroSec -> Section
mkIntroSec :: SystemInformation -> IntroSec -> Section
mkIntroSec si :: SystemInformation
si (IntroProg probIntro :: Sentence
probIntro progDefn :: Sentence
progDefn l :: [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 (SystemInformation -> IntroSub -> Section
mkSubIntro SystemInformation
si) [IntroSub]
l
where
mkSubIntro :: SystemInformation -> IntroSub -> Section
mkSubIntro :: SystemInformation -> IntroSub -> Section
mkSubIntro _ (IPurpose intro :: [Sentence]
intro) = [Sentence] -> Section
Intro.purposeOfDoc [Sentence]
intro
mkSubIntro _ (IScope main :: Sentence
main) = Sentence -> Section
Intro.scopeOfRequirements Sentence
main
mkSubIntro SI {_sys :: ()
_sys = a
sys} (IChar assumed :: [Sentence]
assumed topic :: [Sentence]
topic asset :: [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 _ (IOrgSec i :: Sentence
i b :: CI
b s :: Section
s t :: Sentence
t) = Sentence -> CI -> Section -> Sentence -> Section
forall c.
NamedIdea c =>
Sentence -> c -> Section -> Sentence -> Section
Intro.orgSec Sentence
i CI
b Section
s Sentence
t
mkStkhldrSec :: StkhldrSec -> Section
mkStkhldrSec :: StkhldrSec -> Section
mkStkhldrSec (StkhldrProg l :: [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 kWrd :: CI
kWrd details :: Sentence
details) = CI -> Sentence -> Section
forall a. Idea a => a -> Sentence -> Section
Stk.tClientF CI
kWrd Sentence
details
mkSubs (Cstmr kWrd :: CI
kWrd) = CI -> Section
forall a. Idea a => a -> Section
Stk.tCustomerF CI
kWrd
mkGSDSec :: GSDSec -> Section
mkGSDSec :: GSDSec -> Section
mkGSDSec (GSDProg l :: [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 cs :: [Contents]
cs) = [Contents] -> Section
GSD.sysContxt [Contents]
cs
mkSubs (UsrChars intro :: [Contents]
intro) = [Contents] -> Section
GSD.usrCharsF [Contents]
intro
mkSubs (SystCons cntnts :: [Contents]
cntnts subsec :: [Section]
subsec) = [Contents] -> [Section] -> Section
GSD.systCon [Contents]
cntnts [Section]
subsec
mkSSDSec :: SystemInformation -> SSDSec -> Section
mkSSDSec :: SystemInformation -> SSDSec -> Section
mkSSDSec si :: SystemInformation
si (SSDProg l :: [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 (SystemInformation -> SSDSub -> Section
mkSubSSD SystemInformation
si) [SSDSub]
l
where
mkSubSSD :: SystemInformation -> SSDSub -> Section
mkSubSSD :: SystemInformation -> SSDSub -> Section
mkSubSSD sysi :: SystemInformation
sysi (SSDProblem pd :: ProblemDescription
pd) = SystemInformation -> ProblemDescription -> Section
mkSSDProb SystemInformation
sysi ProblemDescription
pd
mkSubSSD sysi :: SystemInformation
sysi (SSDSolChSpec scs :: SolChSpec
scs) = SystemInformation -> SolChSpec -> Section
mkSolChSpec SystemInformation
sysi SolChSpec
scs
mkSSDProb :: SystemInformation -> ProblemDescription -> Section
mkSSDProb :: SystemInformation -> ProblemDescription -> Section
mkSSDProb _ (PDProg prob :: Sentence
prob subSec :: [Section]
subSec subPD :: [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 sen :: Maybe Sentence
sen concepts :: [c]
concepts) = Maybe Sentence -> [c] -> Section
forall c. Concept c => Maybe Sentence -> [c] -> Section
SSD.termDefnF Maybe Sentence
sen [c]
concepts
mkSubPD (PhySysDesc prog :: a
prog parts :: [Sentence]
parts dif :: LabelledContent
dif extra :: [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 ins :: [Sentence]
ins g :: [ConceptInstance]
g) = [Sentence] -> [Contents] -> Section
SSD.goalStmtF [Sentence]
ins ([ConceptInstance] -> [Contents]
forall c.
(Referable c, HasShortName c, Definition c) =>
[c] -> [Contents]
mkEnumSimpleD [ConceptInstance]
g)
mkSolChSpec :: SystemInformation -> SolChSpec -> Section
mkSolChSpec :: SystemInformation -> SolChSpec -> Section
mkSolChSpec si :: SystemInformation
si (SCSProg l :: [SCSSub]
l) =
[Contents] -> [Section] -> Section
SRS.solCharSpec [IdeaDict -> Section -> Contents
forall a. Idea a => a -> Section -> Contents
SSD.solutionCharSpecIntro (SystemInformation -> IdeaDict
siSys SystemInformation
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 (SystemInformation -> SCSSub -> Section
mkSubSCS SystemInformation
si) [SCSSub]
l
where
mkSubSCS :: SystemInformation -> SCSSub -> Section
mkSubSCS :: SystemInformation -> SCSSub -> Section
mkSubSCS _ (TMs _ _ []) = String -> Section
forall a. HasCallStack => String -> a
error "There are no Theoretical Models"
mkSubSCS _ (GDs _ _ [] _) = [Contents] -> Section
SSD.genDefnF []
mkSubSCS _ (DDs _ _ [] _) = String -> Section
forall a. HasCallStack => String -> a
error "There are no Data Definitions"
mkSubSCS _ (IMs _ _ [] _) = String -> Section
forall a. HasCallStack => String -> a
error "There are no Instance Models"
mkSubSCS si' :: SystemInformation
si' (TMs intro :: [Sentence]
intro fields :: Fields
fields ts :: [TheoryModel]
ts) =
IdeaDict -> [Contents] -> Section
forall a. Idea a => a -> [Contents] -> Section
SSD.thModF (SystemInformation -> IdeaDict
siSys SystemInformation
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 -> SystemInformation -> TheoryModel -> LabelledContent
tmodel Fields
fields SystemInformation
si') [TheoryModel]
ts
mkSubSCS si' :: SystemInformation
si' (DDs intro :: [Sentence]
intro fields :: Fields
fields dds :: [DataDefinition]
dds 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 e :: DataDefinition
e = [LabelledContent -> Contents
LlC (LabelledContent -> Contents) -> LabelledContent -> Contents
forall a b. (a -> b) -> a -> b
$ Fields -> SystemInformation -> DataDefinition -> LabelledContent
ddefn Fields
fields SystemInformation
si' DataDefinition
e, DataDefinition -> Contents
forall c.
(HasDerivation c, HasShortName c, Referable c) =>
c -> Contents
derivation DataDefinition
e]
mkSubSCS si' :: SystemInformation
si' (DDs intro :: [Sentence]
intro fields :: Fields
fields dds :: [DataDefinition]
dds _) =
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 e :: DataDefinition
e = LabelledContent -> Contents
LlC (LabelledContent -> Contents) -> LabelledContent -> Contents
forall a b. (a -> b) -> a -> b
$ Fields -> SystemInformation -> DataDefinition -> LabelledContent
ddefn Fields
fields SystemInformation
si' DataDefinition
e
mkSubSCS si' :: SystemInformation
si' (GDs intro :: [Sentence]
intro fields :: Fields
fields gs' :: [GenDefn]
gs' 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 (\x :: GenDefn
x -> [LabelledContent -> Contents
LlC (LabelledContent -> Contents) -> LabelledContent -> Contents
forall a b. (a -> b) -> a -> b
$ Fields -> SystemInformation -> GenDefn -> LabelledContent
gdefn Fields
fields SystemInformation
si' GenDefn
x, GenDefn -> Contents
forall c.
(HasDerivation c, HasShortName c, Referable c) =>
c -> Contents
derivation GenDefn
x]) [GenDefn]
gs'
mkSubSCS si' :: SystemInformation
si' (GDs intro :: [Sentence]
intro fields :: Fields
fields gs' :: [GenDefn]
gs' _) =
[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 -> SystemInformation -> GenDefn -> LabelledContent
gdefn Fields
fields SystemInformation
si') [GenDefn]
gs'
mkSubSCS si' :: SystemInformation
si' (IMs intro :: [Sentence]
intro fields :: Fields
fields ims :: [InstanceModel]
ims ShowDerivation) =
Section -> Section -> Section -> Section -> [Contents] -> Section
SSD.inModelF Section
SSD.pdStub Section
SSD.ddStub Section
SSD.tmStub ([Contents] -> [Section] -> Section
SRS.genDefn [] []) ([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 (\x :: InstanceModel
x -> [LabelledContent -> Contents
LlC (LabelledContent -> Contents) -> LabelledContent -> Contents
forall a b. (a -> b) -> a -> b
$ Fields -> SystemInformation -> InstanceModel -> LabelledContent
instanceModel Fields
fields SystemInformation
si' InstanceModel
x, InstanceModel -> Contents
forall c.
(HasDerivation c, HasShortName c, Referable c) =>
c -> Contents
derivation InstanceModel
x]) [InstanceModel]
ims
mkSubSCS si' :: SystemInformation
si' (IMs intro :: [Sentence]
intro fields :: Fields
fields ims :: [InstanceModel]
ims _) =
Section -> Section -> Section -> Section -> [Contents] -> Section
SSD.inModelF Section
SSD.pdStub Section
SSD.ddStub Section
SSD.tmStub ([Contents] -> [Section] -> Section
SRS.genDefn [] []) ([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 -> SystemInformation -> InstanceModel -> LabelledContent
instanceModel Fields
fields SystemInformation
si') [InstanceModel]
ims
mkSubSCS si' :: SystemInformation
si' (Assumptions ci :: [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 -> SystemInformation -> ConceptInstance
`SSD.helperCI` SystemInformation
si') [ConceptInstance]
ci
mkSubSCS _ (Constraints end :: Sentence
end cs :: [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 _ (CorrSolnPpties c :: [c]
c cs :: [Contents]
cs) = [c] -> [Contents] -> Section
forall c.
(Quantity c, Constrained c) =>
[c] -> [Contents] -> Section
SSD.propCorSolF [c]
c [Contents]
cs
siSys :: SystemInformation -> IdeaDict
siSys :: SystemInformation -> IdeaDict
siSys SI {_sys :: ()
_sys = a
sys} = a -> IdeaDict
forall c. Idea c => c -> IdeaDict
nw a
sys
mkReqrmntSec :: ReqrmntSec -> Section
mkReqrmntSec :: ReqrmntSec -> Section
mkReqrmntSec (ReqsProg l :: [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 frs :: [ConceptInstance]
frs tbs :: [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 (FReqsSub' frs :: [ConceptInstance]
frs tbs :: [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 nfrs :: [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 c :: [ConceptInstance]
c) = [Contents] -> [Section] -> Section
SRS.likeChg (Contents
intro Contents -> [Contents] -> [Contents]
forall a. a -> [a] -> [a]
: [ConceptInstance] -> [Contents]
forall c.
(Referable c, HasShortName c, Definition c) =>
[c] -> [Contents]
mkEnumSimpleD [ConceptInstance]
c) []
where intro :: Contents
intro = [Sentence] -> Contents
foldlSP [String -> Sentence
S "This", NamedChunk -> Sentence
forall n. (HasUID n, NamedIdea n) => n -> Sentence
phrase NamedChunk
Doc.section_, String -> Sentence
S "lists the",
CI -> Sentence
forall n. (HasUID n, NamedIdea n) => n -> Sentence
plural CI
Doc.likelyChg, String -> Sentence
S "to be made to the", NamedChunk -> Sentence
forall n. (HasUID n, NamedIdea n) => n -> Sentence
phrase NamedChunk
Doc.software]
mkUCsSec :: UCsSec -> Section
mkUCsSec :: UCsSec -> Section
mkUCsSec (UCsProg c :: [ConceptInstance]
c) = [Contents] -> [Section] -> Section
SRS.unlikeChg (Contents
intro Contents -> [Contents] -> [Contents]
forall a. a -> [a] -> [a]
: [ConceptInstance] -> [Contents]
forall c.
(Referable c, HasShortName c, Definition c) =>
[c] -> [Contents]
mkEnumSimpleD [ConceptInstance]
c) []
where intro :: Contents
intro = [Sentence] -> Contents
foldlSP [String -> Sentence
S "This", NamedChunk -> Sentence
forall n. (HasUID n, NamedIdea n) => n -> Sentence
phrase NamedChunk
Doc.section_, String -> Sentence
S "lists the",
CI -> Sentence
forall n. (HasUID n, NamedIdea n) => n -> Sentence
plural CI
Doc.unlikelyChg, String -> Sentence
S "to be made to the", NamedChunk -> Sentence
forall n. (HasUID n, NamedIdea n) => n -> Sentence
phrase NamedChunk
Doc.software]
mkTraceabilitySec :: TraceabilitySec -> SystemInformation -> Section
mkTraceabilitySec :: TraceabilitySec -> SystemInformation -> Section
mkTraceabilitySec (TraceabilityProg progs :: [TraceConfig]
progs) si :: SystemInformation
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 _ pre :: [Sentence]
pre _ _ _) -> SepType -> FoldType -> [Sentence] -> Sentence
foldlList SepType
Comma FoldType
List [Sentence]
pre) [TraceConfig]
progs)
((LabelledContent -> Contents) -> [LabelledContent] -> [Contents]
forall a b. (a -> b) -> [a] -> [b]
map LabelledContent -> Contents
LlC [LabelledContent]
trace) ((Char -> Bool) -> String -> String
forall a. (a -> Bool) -> [a] -> [a]
filter (Bool -> Bool
not(Bool -> Bool) -> (Char -> Bool) -> Char -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
.Char -> Bool
isSpace) (String -> String) -> String -> String
forall a b. (a -> b) -> a -> b
$ a -> String
forall c. CommonIdea c => c -> String
abrv a
sys) []
where
trace :: [LabelledContent]
trace = (TraceConfig -> LabelledContent)
-> [TraceConfig] -> [LabelledContent]
forall a b. (a -> b) -> [a] -> [b]
map (\(TraceConfig u :: UID
u _ desc :: Sentence
desc rows :: [TraceViewCat]
rows cols :: [TraceViewCat]
cols) -> UID
-> Sentence
-> [TraceViewCat]
-> [TraceViewCat]
-> SystemInformation
-> LabelledContent
TM.generateTraceTableView
UID
u Sentence
desc [TraceViewCat]
rows [TraceViewCat]
cols SystemInformation
si) [TraceConfig]
progs
mkOffShelfSolnSec :: OffShelfSolnsSec -> Section
mkOffShelfSolnSec :: OffShelfSolnsSec -> Section
mkOffShelfSolnSec (OffShelfSolnsProg cs :: [Contents]
cs) = [Contents] -> [Section] -> Section
SRS.offShelfSol [Contents]
cs []
mkAuxConsSec :: AuxConstntSec -> Section
mkAuxConsSec :: AuxConstntSec -> Section
mkAuxConsSec (AuxConsProg key :: CI
key listOfCons :: [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 bib :: 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 cs :: [Contents]
cs) = [Contents] -> [Section] -> Section
SRS.appendix [Contents]
cs []