-- | Defines functions used in creating an introduction section.
module Drasil.SRS.Sections.Introduction (orgSec, introductionSection,
  purposeOfDoc, scopeOfRequirements, charIntRdrF) where

import Control.Lens ((^.))
import Data.Maybe (maybeToList)

-- Generic Drasil
import Language.Drasil
import Language.Drasil.Document hiding (organization)
import Language.Drasil.Chunk.Concept.NamedCombinators (andThe, the)
import Drasil.SRS.DocumentLanguage.Definitions(Verbosity(..))
import qualified Language.Drasil.Development as D
import qualified Language.Drasil.Sentence.Combinators as S
import Drasil.System (ProjectName, HasSystemMeta(projName), projAbrvS)

-- Vocabulary
import Drasil.Metadata.Citations (parnasClements1986, smithEtAl2007,
  smithKoothoor2016, smithLai2005, koothoor2013)
import Drasil.Metadata.Concepts.Computation (algorithm)
import Drasil.Metadata.TheoryConcepts (inModel, thModel)
import Drasil.Metadata.Documentation (assumption, characteristic, decision,
  definition, desSpec, design, designDoc, document, documentation, environment,
  goal, goalStmt, implementation, information, intReader, model, organization,
  problem, problemIntro, purpose, requirement, scope, section_, softwareDoc,
  softwareVAV, srs, systemConstraint, template, theory, user, vavPlan)
import Drasil.Metadata.Software.Products (sciCompS)

-- Other docLang
import qualified Drasil.SRS.Concepts as SRS (intro, prpsOfDoc, scpOfReq,
  charOfIR, orgOfDoc, goalStmt, thModel, inModel, sysCon)
import Drasil.SRS.DocumentLanguage.Core (IntroSub(..), PurposeDescription(..))
import Drasil.SRS.Sections.ReferenceMaterial(emptySectSentPlu, emptySectSentSing)
import Drasil.SRS.SmithEtAlSRS (SmithEtAlSRS)

-----------------------
--     Constants     --
-----------------------

-- | 'Sentence' that explains the development process of a program.
developmentProcessParagraph :: Sentence
developmentProcessParagraph :: Sentence
developmentProcessParagraph = [Sentence] -> Sentence
foldlSent [String -> Sentence
S String
"This", IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
document,
  String -> Sentence
S String
"will be used as a starting point for subsequent development",
  String -> Sentence
S String
"phases, including writing the", NPStruct -> Sentence
D.toSent (NP -> NPStruct
forall n. NounPhrase n => n -> NPStruct
phraseNP (CI
desSpec CI -> IdeaDict -> NP
forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`andThe` IdeaDict
softwareVAV)) Sentence -> Sentence -> Sentence
+:+.
  String -> Sentence
S String
"plan", NPStruct -> Sentence
D.toSent (NPStruct -> Sentence) -> NPStruct -> Sentence
forall a b. (a -> b) -> a -> b
$ NP -> NPStruct
forall n. NounPhrase n => n -> NPStruct
atStartNP (IdeaDict -> NP
forall t. NamedIdea t => t -> NP
the IdeaDict
designDoc), String -> Sentence
S String
"will show how the",
  CI -> Sentence
forall n. NamedIdea n => n -> Sentence
plural CI
requirement, String -> Sentence
S String
"are to be realized, including", IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
plural IdeaDict
decision,
  String -> Sentence
S String
"on the numerical", ConceptChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
plural ConceptChunk
algorithm, String -> Sentence
S String
"and programming" Sentence -> Sentence -> Sentence
+:+.
  IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
environment, String -> Sentence
S String
"The", IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
vavPlan,
  String -> Sentence
S String
"will show the steps that will be used to increase confidence in the",
  (NPStruct -> Sentence
D.toSent (NP -> NPStruct
forall n. NounPhrase n => n -> NPStruct
phraseNP (IdeaDict
softwareDoc IdeaDict -> IdeaDict -> NP
forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`andThe` IdeaDict
implementation)) Sentence -> Sentence
!.), String -> Sentence
S String
"Although",
  String -> Sentence
S String
"the", CI -> Sentence
forall c. Idea c => c -> Sentence
short CI
srs, String -> Sentence
S String
"fits in a series of", IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
plural IdeaDict
document,
  String -> Sentence
S String
"that follow the so-called waterfall", IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
model Sentence -> Sentence -> Sentence
`sC`
  String -> Sentence
S String
"the actual development process is not constrained",
  String -> Sentence
S String
"in any way. Even when the waterfall model is not followed, as",
  String -> Sentence
S String
"Parnas and Clements point out", Citation -> Sentence
forall r.
(IsChunk r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS Citation
parnasClements1986 Sentence -> Sentence -> Sentence
`sC`
  String -> Sentence
S String
"the most logical way to present the", IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
documentation,
  String -> Sentence
S String
"is still to", Sentence -> Sentence
Quote (String -> Sentence
S String
"fake"), String -> Sentence
S String
"a rational", IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
design,
  String -> Sentence
S String
"process"]

-- | 'Sentence' containing the subsections of the Introduction. Takes a list of
-- IntroSub and generates a sentence listing only the subsections that exist.
introductionSubsections :: [IntroSub] -> Sentence
introductionSubsections :: [IntroSub] -> Sentence
introductionSubsections [IntroSub]
subs =
  let subDescriptions :: [Sentence]
subDescriptions = (IntroSub -> [Sentence]) -> [IntroSub] -> [Sentence]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap IntroSub -> [Sentence]
introSubToSentence [IntroSub]
subs
  in case [Sentence]
subDescriptions of
    [] -> Sentence
EmptyS
    [Sentence]
_  -> String -> Sentence
S String
"," Sentence -> Sentence -> Sentence
:+: String -> Sentence
S String
" " Sentence -> Sentence -> Sentence
:+: SepType -> FoldType -> [Sentence] -> Sentence
foldlList SepType
Comma FoldType
List [Sentence]
subDescriptions

-- | Convert an IntroSub to its description sentence for the roadmap.
introSubToSentence :: IntroSub -> [Sentence]
introSubToSentence :: IntroSub -> [Sentence]
introSubToSentence (IPurpose PurposeDescription
_) = []  -- Purpose is already mentioned as "purpose of this document"
introSubToSentence (IScope Sentence
_)   = [Sentence -> Sentence -> Sentence
S.the_ofThe (IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
scope) (CI -> Sentence
forall n. NamedIdea n => n -> Sentence
plural CI
requirement)]
introSubToSentence IChar {} = [Sentence -> Sentence -> Sentence
S.the_ofThe (IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
plural IdeaDict
characteristic) (IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
intReader)]
introSubToSentence IOrgSec {} = [Sentence -> Sentence -> Sentence
S.the_ofThe (IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
organization) (IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
document)]

-------------------------
--                    --
-------------------------

-- | Constructor for the Introduction section. In order, the parameters are:
--
--     * problemIntroduction - 'Sentence' introducing the specific example problem.
--     * programDefinition  - 'SmithEtAlSRS' definition of the specific example.
--     * extraInfo          - List of extra 'Sentence's to include in the overview paragraph.
--     * introSubs          - List of IntroSub describing what subsections exist.
--     * subSections        - List of subsections for this section.
introductionSection :: Sentence -> SmithEtAlSRS -> [Sentence] -> [IntroSub] -> [Section] -> Section
introductionSection :: Sentence
-> SmithEtAlSRS -> [Sentence] -> [IntroSub] -> [Section] -> Section
introductionSection Sentence
EmptyS              SmithEtAlSRS
programDefinition [Sentence]
extraInfo [IntroSub]
introSubs = [Contents] -> [Section] -> Section
SRS.intro
  [Sentence -> Contents
mkParagraph (Sentence -> Contents) -> Sentence -> Contents
forall a b. (a -> b) -> a -> b
$ [IdeaDict] -> Sentence
forall n. NamedIdea n => [n] -> Sentence
emptySectSentSing [IdeaDict
problemIntro],
  SmithEtAlSRS -> [Sentence] -> [IntroSub] -> Contents
overviewParagraph SmithEtAlSRS
programDefinition [Sentence]
extraInfo [IntroSub]
introSubs]
introductionSection Sentence
problemIntroduction SmithEtAlSRS
programDefinition [Sentence]
extraInfo [IntroSub]
introSubs = [Contents] -> [Section] -> Section
SRS.intro
  [Sentence -> Contents
mkParagraph Sentence
problemIntroduction, SmithEtAlSRS -> [Sentence] -> [IntroSub] -> Contents
overviewParagraph SmithEtAlSRS
programDefinition [Sentence]
extraInfo [IntroSub]
introSubs]

-- | Constructor for the overview paragraph for the Introduction.
-- Takes the definition of the specific example being generated ('Sentence'),
-- additional information ('[Sentence]'), and the list of IntroSub to dynamically generate the roadmap.
overviewParagraph :: SmithEtAlSRS -> [Sentence] -> [IntroSub] -> Contents
overviewParagraph :: SmithEtAlSRS -> [Sentence] -> [IntroSub] -> Contents
overviewParagraph SmithEtAlSRS
si [Sentence]
extraInfo [IntroSub]
introSubs =
  let subsectionsSentence :: Sentence
subsectionsSentence = [IntroSub] -> Sentence
introductionSubsections [IntroSub]
introSubs
      -- Build the sentence ending based on whether there are subsections
      endingSentence :: Sentence
endingSentence = case Sentence
subsectionsSentence of
        Sentence
EmptyS -> IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
document  -- No subsections, end with just "document"
        Sentence
_      -> IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
document Sentence -> Sentence -> Sentence
:+: Sentence
subsectionsSentence  -- Has subsections, add them
  in [Sentence] -> Contents
foldlSP ([String -> Sentence
S String
"The following", IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
section_,
    String -> Sentence
S String
"provides an overview of the", CI -> Sentence
forall c. Idea c => c -> Sentence
introduceAbb CI
srs, String -> Sentence
S String
"for" Sentence -> Sentence -> Sentence
+:+. ProjectName -> Sentence
projAbrvS (SmithEtAlSRS
si SmithEtAlSRS
-> Getting ProjectName SmithEtAlSRS ProjectName -> ProjectName
forall s a. s -> Getting a s a -> a
^. Getting ProjectName SmithEtAlSRS ProjectName
forall c. HasSystemMeta c => Lens' c ProjectName
Lens' SmithEtAlSRS ProjectName
projName)]
    [Sentence] -> [Sentence] -> [Sentence]
forall a. [a] -> [a] -> [a]
++ [Sentence]
extraInfo [Sentence] -> [Sentence] -> [Sentence]
forall a. [a] -> [a] -> [a]
++
    [String -> Sentence
S String
"This", IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
section_, String -> Sentence
S String
"explains the", IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
purpose, String -> Sentence
S String
"of this", Sentence
endingSentence])

-- | Constructor for Purpose of Document section that each example controls.
purpDocPara1 :: ProjectName -> Sentence
purpDocPara1 :: ProjectName -> Sentence
purpDocPara1 ProjectName
proName = [Sentence] -> Sentence
foldlSent [String -> Sentence
S String
"The primary purpose of this", IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
document, String -> Sentence
S String
"is to",
  String -> Sentence
S String
"record the", CI -> Sentence
forall n. NamedIdea n => n -> Sentence
plural CI
requirement, String -> Sentence
S String
"of" Sentence -> Sentence -> Sentence
+:+. Sentence
projAb,
  IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
atStart' IdeaDict
goal Sentence -> Sentence -> Sentence
`sC` CI -> Sentence
forall n. NamedIdea n => n -> Sentence
plural CI
assumption Sentence -> Sentence -> Sentence
`sC` CI -> Sentence
forall n. NamedIdea n => n -> Sentence
plural CI
thModel Sentence -> Sentence -> Sentence
`sC`
  IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
plural IdeaDict
definition Sentence -> Sentence -> Sentence
`sC` String -> Sentence
S String
"and other", IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
model, String -> Sentence
S String
"derivation",
  IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
information, String -> Sentence
S String
"are specified" Sentence -> Sentence -> Sentence
`sC` String -> Sentence
S String
"allowing the reader to fully",
  String -> Sentence
S String
"understand" Sentence -> Sentence -> Sentence
`S.and_` String -> Sentence
S String
"verify the", IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
purpose Sentence -> Sentence -> Sentence
`S.and_` String -> Sentence
S String
"scientific",
  String -> Sentence
S String
"basis of" Sentence -> Sentence -> Sentence
+:+. Sentence
projAb, String -> Sentence
S String
"With the exception of",
  Section -> Sentence -> Sentence
forall r.
(IsChunk r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef ([Contents] -> [Section] -> Section
SRS.sysCon [] []) (IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
plural IdeaDict
systemConstraint) Sentence -> Sentence -> Sentence
`sC` String -> Sentence
S String
"this",
  CI -> Sentence
forall c. Idea c => c -> Sentence
short CI
srs, String -> Sentence
S String
"will remain abstract, describing what", IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
problem,
  String -> Sentence
S String
"is being solved, but not how to solve it"]
  where
    projAb :: Sentence
projAb = ProjectName -> Sentence
projAbrvS ProjectName
proName

-- | Constructor for Purpose of Document subsection. Takes a list of 'Sentence's that:
--
--     * Given one element: explains the purpose of the specific example.
--     * Given two elements: explains the purpose of the specific example and the development process.
--     * Otherwise: Uses the default 'developmentProcessParagraph'.
purposeOfDoc :: SmithEtAlSRS -> PurposeDescription -> Section
purposeOfDoc :: SmithEtAlSRS -> PurposeDescription -> Section
purposeOfDoc SmithEtAlSRS
srd (StdPurp Verbosity
Succinct) = [Contents] -> [Section] -> Section
SRS.prpsOfDoc [Sentence -> Contents
mkParagraph (Sentence -> Contents) -> Sentence -> Contents
forall a b. (a -> b) -> a -> b
$ ProjectName -> Sentence
purpDocPara1 (ProjectName -> Sentence) -> ProjectName -> Sentence
forall a b. (a -> b) -> a -> b
$ SmithEtAlSRS
srd SmithEtAlSRS
-> Getting ProjectName SmithEtAlSRS ProjectName -> ProjectName
forall s a. s -> Getting a s a -> a
^. Getting ProjectName SmithEtAlSRS ProjectName
forall c. HasSystemMeta c => Lens' c ProjectName
Lens' SmithEtAlSRS ProjectName
projName] []
purposeOfDoc SmithEtAlSRS
srd (StdPurp Verbosity
Verbose) = [Contents] -> [Section] -> Section
SRS.prpsOfDoc [Sentence -> Contents
mkParagraph (Sentence -> Contents) -> Sentence -> Contents
forall a b. (a -> b) -> a -> b
$ ProjectName -> Sentence
purpDocPara1 (ProjectName -> Sentence) -> ProjectName -> Sentence
forall a b. (a -> b) -> a -> b
$ SmithEtAlSRS
srd SmithEtAlSRS
-> Getting ProjectName SmithEtAlSRS ProjectName -> ProjectName
forall s a. s -> Getting a s a -> a
^. Getting ProjectName SmithEtAlSRS ProjectName
forall c. HasSystemMeta c => Lens' c ProjectName
Lens' SmithEtAlSRS ProjectName
projName, Sentence -> Contents
mkParagraph Sentence
developmentProcessParagraph] []
purposeOfDoc SmithEtAlSRS
_   (CustomPurp [[Sentence]]
ss) = [Contents] -> [Section] -> Section
SRS.prpsOfDoc (([Sentence] -> Contents) -> [[Sentence]] -> [Contents]
forall a b. (a -> b) -> [a] -> [b]
map (UnlabelledContent -> Contents
UlC (UnlabelledContent -> Contents)
-> ([Sentence] -> UnlabelledContent) -> [Sentence] -> Contents
forall b c a. (b -> c) -> (a -> b) -> a -> c
. RawContent -> UnlabelledContent
ulcc (RawContent -> UnlabelledContent)
-> ([Sentence] -> RawContent) -> [Sentence] -> UnlabelledContent
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Sentence] -> RawContent
Para) [[Sentence]]
ss) []

-- | Constructor for the Scope of Requirements subsection.
-- Takes in the main requirement for the program.
scopeOfRequirements :: Sentence -> Section
scopeOfRequirements :: Sentence -> Section
scopeOfRequirements Sentence
EmptyS = [Contents] -> [Section] -> Section
SRS.scpOfReq [Sentence -> Contents
mkParagraph (Sentence -> Contents) -> Sentence -> Contents
forall a b. (a -> b) -> a -> b
$ [CI] -> Sentence
forall n. NamedIdea n => [n] -> Sentence
emptySectSentPlu [CI
requirement]] []
scopeOfRequirements Sentence
req = [Contents] -> [Section] -> Section
SRS.scpOfReq [[Sentence] -> Contents
foldlSP
  [IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
scope Sentence -> Sentence -> Sentence
`S.the_ofTheC` CI -> Sentence
forall n. NamedIdea n => n -> Sentence
plural CI
requirement, String -> Sentence
S String
"includes", Sentence
req]] []

-- | Constructor for characteristics of the intended reader subsection. Takes
-- the program name ('ProjectName'), assumed knowledge ('Sentence's),
-- topic-related subjects ('Sentence's), knowledge assets ('Sentence's), and
-- references ('Section').
charIntRdrF :: ProjectName -> [Sentence] -> [Sentence] -> [Sentence] ->
  Section -> Section
charIntRdrF :: ProjectName
-> [Sentence] -> [Sentence] -> [Sentence] -> Section -> Section
charIntRdrF ProjectName
progName [Sentence]
assumed [Sentence]
topic [Sentence]
asset Section
r =
  [Contents] -> [Section] -> Section
SRS.charOfIR (ProjectName
-> [Sentence] -> [Sentence] -> [Sentence] -> Section -> [Contents]
intReaderIntro ProjectName
progName [Sentence]
assumed [Sentence]
topic [Sentence]
asset Section
r) []

-- | Helper that creates a paragraph. Called by 'charIntRdrF'. The parameters (in order) should be:
--
--     * program name,
--     * subjects the reader is assumed to understand,
--     * topic-related subjects that the reader should understand,
--     * subjects that would be an asset if the reader understood them,
--     * reference to User Characteristics section.
intReaderIntro :: ProjectName -> [Sentence] -> [Sentence] -> [Sentence] ->
  Section -> [Contents]
intReaderIntro :: ProjectName
-> [Sentence] -> [Sentence] -> [Sentence] -> Section -> [Contents]
intReaderIntro ProjectName
_ [] [] [] Section
_ =
  [[Sentence] -> Contents
foldlSP [String -> Sentence
S String
"Reviewers of this", IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
documentation,
  String -> Sentence
S String
"do not need any prerequisite knowledge"]]
intReaderIntro ProjectName
progName [Sentence]
assumed [Sentence]
topic [Sentence]
asset Section
sectionRef =
  [[Sentence] -> Contents
foldlSP [String -> Sentence
S String
"Reviewers of this", IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
documentation,
  String -> Sentence
S String
"should have an understanding of" Sentence -> Sentence -> Sentence
+:+.
  SepType -> FoldType -> [Sentence] -> Sentence
foldlList SepType
Comma FoldType
List ([Sentence]
assumed [Sentence] -> [Sentence] -> [Sentence]
forall a. [a] -> [a] -> [a]
++ [Sentence]
topic), Sentence
assetSent,
  NPStruct -> Sentence
D.toSent (NP -> NPStruct
forall n. NounPhrase n => n -> NPStruct
atStartNP' (IdeaDict -> NP
forall t. NamedIdea t => t -> NP
the IdeaDict
user)) Sentence -> Sentence -> Sentence
`S.of_` ProjectName -> Sentence
projAbrvS ProjectName
progName, String -> Sentence
S String
"can have a lower level" Sentence -> Sentence -> Sentence
`S.of_`
  String -> Sentence
S String
"expertise, as explained" Sentence -> Sentence -> Sentence
`S.in_` Section -> Sentence
forall r.
(IsChunk r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS Section
sectionRef]]
  where
    assetSent :: Sentence
assetSent = case [Sentence]
asset of
      [] -> Sentence
EmptyS
      [Sentence]
_  -> String -> Sentence
S String
"It would be an asset to understand" Sentence -> Sentence -> Sentence
+:+. SepType -> FoldType -> [Sentence] -> Sentence
foldlList SepType
Comma FoldType
List [Sentence]
asset

-- | Constructor for the Organization of the Document section. Parameters should
-- be an introduction ('Sentence'), a resource for a bottom up approach
-- ('NamedIdea'), reference to that resource ('Section'), and any other relevant
-- information ('Sentence').
orgSec :: NamedIdea c => c -> Section -> Maybe Sentence -> Section
orgSec :: forall c. NamedIdea c => c -> Section -> Maybe Sentence -> Section
orgSec c
b Section
s Maybe Sentence
t = [Contents] -> [Section] -> Section
SRS.orgOfDoc (c -> Section -> Maybe Sentence -> [Contents]
forall c.
NamedIdea c =>
c -> Section -> Maybe Sentence -> [Contents]
orgIntro c
b Section
s Maybe Sentence
t) []

-- | Helper function that creates the introduction for the Organization of the
-- Document section. Parameters should be an introduction ('Sentence'), a
-- resource for a bottom up approach ('NamedIdea'), reference to that resource
-- ('Section'), and any other relevant information ('Sentence').
orgIntro :: NamedIdea c => c -> Section -> Maybe Sentence -> [Contents]
orgIntro :: forall c.
NamedIdea c =>
c -> Section -> Maybe Sentence -> [Contents]
orgIntro c
bottom Section
bottomSec Maybe Sentence
trailingSentence =
  [ [Sentence] -> Contents
foldlSP [
      Sentence
orgOfDocIntro, String -> Sentence
S String
"The presentation follows the standard pattern of presenting" Sentence -> Sentence -> Sentence
+:+.
      -- FIXME: This should be referencing specific sections, if they even
      -- exist.
      SepType -> FoldType -> [Sentence] -> Sentence
foldlList SepType
Comma FoldType
List ((IdeaDict -> Sentence) -> [IdeaDict] -> [Sentence]
forall a b. (a -> b) -> [a] -> [b]
map IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
plural [IdeaDict
goal, IdeaDict
theory, IdeaDict
definition] [Sentence] -> [Sentence] -> [Sentence]
forall a. [a] -> [a] -> [a]
++ [CI -> Sentence
forall n. NamedIdea n => n -> Sentence
plural CI
assumption]),
      String -> Sentence
S String
"For readers that would like a more bottom up approach" Sentence -> Sentence -> Sentence
`sC`
      String -> Sentence
S String
"they can start reading the", Section -> Sentence -> Sentence
forall r.
(IsChunk r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef Section
bottomSec (c -> Sentence
forall n. NamedIdea n => n -> Sentence
plural c
bottom)Sentence -> Sentence -> Sentence
`S.and_`
      String -> Sentence
S String
"trace back to find any additional information they require"
    ]
  , [Sentence] -> Contents
foldlSP_ (Sentence
introS Sentence -> [Sentence] -> [Sentence]
forall a. a -> [a] -> [a]
: Maybe Sentence -> [Sentence]
forall a. Maybe a -> [a]
maybeToList Maybe Sentence
trailingSentence)
  ]
  where
    -- FIXME: The below abuses `SRS.goalStmt`, `SRS.thModel`, etc.
    introS :: Sentence
introS = [(CI, Section)] -> Sentence
forall c. NamedIdea c => [(c, Section)] -> Sentence
refineChain ([CI] -> [Section] -> [(CI, Section)]
forall a b. [a] -> [b] -> [(a, b)]
zip
      [CI
goalStmt, CI
thModel, CI
inModel]
      [[Contents] -> [Section] -> Section
SRS.goalStmt [] [], [Contents] -> [Section] -> Section
SRS.thModel [] [], [Contents] -> [Section] -> Section
SRS.inModel [] []])

orgOfDocIntro :: Sentence
orgOfDocIntro :: Sentence
orgOfDocIntro = [Sentence] -> Sentence
foldlSent
  [NPStruct -> Sentence
D.toSent (NPStruct -> Sentence) -> NPStruct -> Sentence
forall a b. (a -> b) -> a -> b
$ NP -> NPStruct
forall n. NounPhrase n => n -> NPStruct
atStartNP (IdeaDict -> NP
forall t. NamedIdea t => t -> NP
the IdeaDict
organization), String -> Sentence
S String
"of this", IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
document,
  String -> Sentence
S String
"follows the", IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
template, String -> Sentence
S String
"for an", CI -> Sentence
forall c. Idea c => c -> Sentence
short CI
srs, String -> Sentence
S String
"for",
  IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
sciCompS, String -> Sentence
S String
"proposed by", SepType -> FoldType -> [Sentence] -> Sentence
foldlList SepType
Comma FoldType
List ([Sentence] -> Sentence) -> [Sentence] -> Sentence
forall a b. (a -> b) -> a -> b
$
    (Citation -> Sentence) -> [Citation] -> [Sentence]
forall a b. (a -> b) -> [a] -> [b]
map Citation -> Sentence
forall r.
(IsChunk r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS [Citation
koothoor2013, Citation
smithLai2005, Citation
smithEtAl2007 , Citation
smithKoothoor2016]]