-
Notifications
You must be signed in to change notification settings - Fork 28
Automatically collect abbreviations from generated DocDescs
#4363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
952a528
6de9dc5
04fd9af
a3d111d
d49a098
d45194d
30d057a
d07b293
41f6823
4ae1045
c072676
0d78660
f08e6e8
0a8ece9
dc1f995
621dd63
63be539
9671d48
fb244cc
4af33a2
0ec56d8
b61d696
3239231
2ac256d
ee80178
f90609d
cecbd9d
6a1e11f
344298a
3c8b565
8d80f11
2f77800
1c23862
a6c3611
d517a94
3268f3d
79d6863
e040350
77b87ea
7639a88
7e22c99
b4c4c73
e8defbd
dda29d9
f73fb86
951208d
2c0c928
e249f93
d2ed561
a6dccc7
4b811fa
17f6cd0
b362518
78a9845
f5b45e7
9c40fb2
248e342
d022a3c
c6b93fb
f0a0bb5
c832dc2
8f2b731
7d7aa62
ea0ecb4
e21e16f
b76a720
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,16 +1,21 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {-# LANGUAGE LambdaCase, Rank2Types #-} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -- | Defines functions to extract certain kinds of information from a document. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -- Mainly used to pull the 'UID's of chunks out of 'Sentence's and 'Expr's. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| module Drasil.ExtractDocDesc (getDocDesc, egetDocDesc, sentencePlate) where | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| module Drasil.ExtractDocDesc ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getDocDesc, egetDocDesc, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sentencePlate, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getSec | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) where | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import Control.Lens((^.)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import Data.Functor.Constant (Constant(Constant)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import Data.Generics.Multiplate (appendPlate, foldFor, purePlate, preorderFold) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import Drasil.DocumentLanguage.Core | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import Drasil.Sections.SpecificSystemDescription (inDataConstTbl, outDataConstTbl) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import Language.Drasil hiding (Manual, Verb) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import Theory.Drasil | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import Data.Functor.Constant (Constant(Constant)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import Data.Generics.Multiplate (appendPlate, foldFor, purePlate, preorderFold) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import Data.Maybe (maybeToList) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -- | Creates a section contents plate that contains diferrent system subsections. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| secConPlate :: Monoid b => (forall a. HasContents a => [a] -> b) -> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -20,8 +25,6 @@ secConPlate mCon mSec = preorderFold $ purePlate { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| introSub = Constant <$> \case | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (IOrgSec _ s _) -> mSec [s] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _ -> mempty, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| --gsdSec = Constant <$> \case | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -- (GSDProg _) -> mempty, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| gsdSub = Constant <$> \case | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (SysCntxt c) -> mCon c | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (UsrChars c) -> mCon c | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -100,33 +103,33 @@ egetCon _ = [] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sentencePlate :: Monoid a => ([Sentence] -> a) -> DLPlate (Constant a) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sentencePlate f = appendPlate (secConPlate (f . concatMap getCon') $ f . concatMap getSec) $ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| preorderFold $ purePlate { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| introSec = Constant . f <$> \(IntroProg s1 s2 _) -> [s1, s2], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| introSec = Constant . f <$> \(IntroProg s1 s2 s3) -> [s1, s2] ++ concatMap getIntroSub s3, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| introSub = Constant . f <$> \case | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (IPurpose s) -> s | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (IScope s) -> [s] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (IChar s1 s2 s3) -> concat [s1, s2, s3] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (IOrgSec _ _ s1) -> [s1], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (IOrgSec _ s1 s2) -> maybeToList s2 ++ getSec s1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| stkSub = Constant . f <$> \case | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (Client _ s) -> [s] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (Cstmr _) -> [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pdSec = Constant . f <$> \(PDProg s _ _) -> [s], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pdSec = Constant . f <$> \(PDProg s secs pds) -> s : concatMap getSec secs ++ concatMap getPDSub pds, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pdSub = Constant . f <$> \case | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (TermsAndDefs Nothing cs) -> def cs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (TermsAndDefs (Just s) cs) -> s : def cs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (PhySysDesc _ s _ _) -> s | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (PhySysDesc _ s lc cs) -> s ++ getLC lc ++ getC cs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (Goals s c) -> s ++ def c, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| scsSub = Constant . f <$> \case | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (Assumptions c) -> def c | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (TMs s _ t) -> let r = (<>) s . concatMap (\x -> def (x ^. operations) ++ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def (x ^. defined_quant) ++ notes [x] ++ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| r (x ^. valid_context)) in r t | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (DDs s _ d _) -> s ++ der d ++ notes d | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (GDs s _ d _) -> def d ++ s ++ der d ++ notes d | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (GDs s _ d _) -> s ++ def d ++ der d ++ notes d | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (IMs s _ d _) -> s ++ der d ++ notes d | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For lines 122 - 127, the first Drasil/code/drasil-docLang/lib/Drasil/DocumentLanguage/Definitions.hs Lines 31 to 44 in a8d7022
The problem with
Drasil/code/drasil-docLang/lib/Drasil/DocumentLanguage/Definitions.hs Lines 217 to 230 in a8d7022
So, even if we wanted to scan the generated tables for sentences or UIDs of chunks we input into sentences, we wouldn't have a UID to scan for. This results in at least Scanning for "Refname" in the codebase shows we just use the string raw, mostly, except for the one CI: ~/Programming/Drasil/code/ tableAccAbbS rg "Refname" -ths
drasil-data/lib/Data/Drasil/Concepts/Documentation.hs
87:refName = commonIdeaWithDict "refName" (cn' "reference name") "Refname" [documentc]
drasil-printers/lib/Language/Drasil/JSON/Print.hs
253: (tr (nbformat (th (text "Refname")) $$ td (nbformat(bold l))) $$ makeDRows ps)
drasil-printers/lib/Language/Drasil/HTML/Print.hs
299: (tr (th (text "Refname") $$ td (bold l)) $$ makeDRows ps)
drasil-printers/lib/Language/Drasil/TeX/Print.hs
344: command0 "toprule " <> bold (pure $ text "Refname") <> pure (text " & ") <> bold l, --shortname instead of refname?
drasil-printers/lib/Language/Drasil/Markdown/Print.hs
224: makeHeaderCols [text "Refname", l] size $$ Scanning for the CI shows we just add it to our ChunkDBs without using it really. λ ~/Programming/Drasil/code/ tableAccAbbS rg "refName" -ths
drasil-data/lib/Data/Drasil/Concepts/Documentation.hs
57: unlikelyChg, notebook, refBy, refName]
60: mg, mis, notApp, srs, typUnc, sec, notebook, refBy, refName :: CI
87:refName = commonIdeaWithDict "refName" (cn' "reference name") "Refname" [documentc]
331: likeChgDom, unlikeChgDom, refByDom, refNameDom :: ConceptChunk
341:refNameDom = ccs (mkIdea "refNameDom" (refName ^. term) $ Just "RefName") EmptyS [srsDom]
346: assumpDom, chgProbDom, likeChgDom, unlikeChgDom, refByDom, refNameDom]
drasil-example/swhs/lib/Drasil/SWHS/Concepts.hs
8: likelyChg, physSyst, requirement, refBy, refName, srs, typUnc, unlikelyChg)
20: physSyst, requirement, refBy, refName, srs, thModel, typUnc, unlikelyChg]
drasil-example/glassbr/lib/Drasil/GlassBR/Concepts.hs
7: notApp, physSyst, response, requirement, refBy, refName, srs, type_, typUnc,
29: refBy, refName, stdOffDist, srs, thModel, typUnc, unlikelyChg]
drasil-example/ssp/lib/Drasil/SSP/Defs.hs
10: likelyChg, physSyst, property, requirement, refBy, refName, safety, srs, typUnc,
21: physSyst, requirement, refBy, refName, srs, thModel, typUnc, unlikelyChg]
drasil-example/gamephysics/lib/Drasil/GamePhysics/Concepts.hs
8: requirement, refBy, refName, srs, typUnc, unlikelyChg)
19: likelyChg, ode, requirement, refBy, refName, srs, thModel, threeD, twoD, typUnc, unlikelyChg]
drasil-example/dblpend/lib/Drasil/DblPend/Unitals.hs
12: requirement, refBy, refName, srs, typUnc)
31: physSyst, requirement, refBy, refName, srs, thModel, typUnc]
drasil-example/pdcontroller/lib/Drasil/PDController/Concepts.hs
7: (assumption, goalStmt, physSyst, requirement, refBy, refName, srs, typUnc)
12: refName, srs, thModel, typUnc, pdControllerCI, proportionalCI, derivativeCI,
λ ~/Programming/Drasil/Drasil/code/ tableAccAbbS Similarly, because of this,
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Switching from
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This definitely shows the problem with My first instinct would be to create a new chunk (
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, this part is still not addressed?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I think this will need to be moved to a new issue. This work is a bit more involved, similar to the work for
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree that it should be handled separately. But should it block this PR? |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (Constraints s _) -> [s] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (CorrSolnPpties _ _) -> [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (CorrSolnPpties _ cs) -> getC cs, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| reqSub = Constant . f <$> \case | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (FReqsSub c _) -> def c | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (FReqsSub c lcs) -> def c ++ concatMap getLC lcs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (NonFReqsSub c) -> def c, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| lcsSec = Constant . f <$> \(LCsProg c) -> def c, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ucsSec = Constant . f <$> \(UCsProg c) -> def c, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -136,17 +139,41 @@ sentencePlate f = appendPlate (secConPlate (f . concatMap getCon') $ f . concatM | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } where | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def :: Definition a => [a] -> [Sentence] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def = map (^. defn) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getIntroSub :: IntroSub -> [Sentence] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getIntroSub (IPurpose ss) = ss | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getIntroSub (IScope s) = [s] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getIntroSub (IChar s1 s2 s3) = s1 ++ s2 ++ s3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getIntroSub (IOrgSec _ s1 s2) = maybeToList s2 ++ getSec s1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| der :: MayHaveDerivation a => [a] -> [Sentence] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| der = concatMap (getDerivSent . (^. derivations)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getDerivSent :: Maybe Derivation -> [Sentence] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getDerivSent Nothing = [] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getDerivSent (Just (Derivation h s)) = h : s | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| notes :: HasAdditionalNotes a => [a] -> [Sentence] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| notes = concatMap (^. getNotes) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getPDSub :: PDSub -> [Sentence] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getPDSub (TermsAndDefs ms c) = def c ++ maybe [] pure ms | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getPDSub (PhySysDesc _ s lc cs) = s ++ getLC lc ++ getC cs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getPDSub (Goals s c) = s ++ def c | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getC :: [Contents] -> [Sentence] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getC = concatMap getCon' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getLC :: LabelledContent -> [Sentence] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getLC = getCon . (^. accessContents) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -- | Extracts 'Sentence's from a document description. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getDocDesc :: DocDesc -> [Sentence] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getDocDesc = fmGetDocDesc (sentencePlate id) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -- ^ FIXME: We want all Sentences from a document (not necessarily a document | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -- description), so we use this function. But 'sentencePlate' does not include | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -- all 'Sentence's! Some only appear when rendering (at least, after | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -- `mkSections` is used on a `DocDesc` to create `[Section]`). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -- | Extracts 'Sentence's from a 'Section'. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getSec :: Section -> [Sentence] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -171,10 +198,9 @@ getCon (DerivBlock h d) = h : concatMap getCon d | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getCon (Enumeration lst) = getLT lst | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getCon (Figure l _ _ _) = [l] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getCon (Bib bref) = getBib bref | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getCon (Graph [(s1, s2)] _ _ l) = [s1, s2, l] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getCon Graph{} = [] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getCon (Defini _ []) = [] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getCon (Defini dt (hd:fs)) = concatMap getCon' (snd hd) ++ getCon (Defini dt fs) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getCon (Graph sss _ _ l) = let (ls, rs) = unzip sss | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| in l : ls ++ rs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getCon (Defini _ ics) = concatMap (concatMap getCon' . snd) ics | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -- | Get the bibliography from something that has a field. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getBib :: (HasFields c) => [c] -> [Sentence] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -206,10 +232,10 @@ getField Year{} = EmptyS | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -- | Translates different types of lists into a 'Sentence' form. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getLT :: ListType -> [Sentence] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getLT (Bullet it) = concatMap (getIL . fst) it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getLT (Numeric it) = concatMap (getIL . fst) it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getLT (Simple lp) = concatMap getLP lp | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getLT (Desc lp) = concatMap getLP lp | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getLT (Bullet it) = concatMap (getIL . fst) it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getLT (Numeric it) = concatMap (getIL . fst) it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getLT (Simple lp) = concatMap getLP lp | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getLT (Desc lp) = concatMap getLP lp | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getLT (Definitions lp) = concatMap getLP lp | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -- | Translates a 'ListTuple' into 'Sentence's. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this code should be refactored into even more generic kit. What you are doing is creating a 'view' (in this case, zooming in to
RefSec), mapping onto one side of that view, and then putting everything back together.A more refined way to do this would take a function (a -> Either b c) instead of a predicate, then two functions (b -> d) and (c -> d) for each side, then you could unEither. In the case below, it would actually be (a -> Either b a) and the function on the
Falsestuff would beid.