diff --git a/code/drasil-docLang/lib/Drasil/Sentence/Combinators.hs b/code/drasil-docLang/lib/Drasil/Sentence/Combinators.hs index f2023452e0..40c3ba8397 100644 --- a/code/drasil-docLang/lib/Drasil/Sentence/Combinators.hs +++ b/code/drasil-docLang/lib/Drasil/Sentence/Combinators.hs @@ -23,8 +23,7 @@ import Control.Lens ((^.)) import Data.Decimal (DecimalRaw, realFracToDecimal) import Data.List (transpose) -import Drasil.Database (HasUID) - +import Drasil.Database (IsChunk) import Language.Drasil (ConceptChunk, DefinesQuantity(defLhs) , UnitDefn, MayHaveUnit(..) , UnitalChunk , HasUnitSymbol(usymb), Quantity, Concept, Definition(defn), NamedIdea(..) , HasSymbol @@ -66,8 +65,9 @@ definedIn' q info = ch (q ^. defLhs) `S.is` S "defined" `S.in_` refS q +:+. info definedIn'' :: (Referable r, HasShortName r) => r -> Sentence definedIn'' q = S "defined" `S.in_` refS q --- | Takes a 'Symbol' and its 'Reference' (does not append a period at the end!). Outputs as "@symbol@ is defined in @source@". -definedIn''' :: (HasSymbol q, HasUID q, Referable r, HasShortName r) => q -> r -> Sentence +-- | Takes a 'Symbol' and its 'Reference' (does not append a period at the +-- end!). Outputs as "@symbol@ is defined in @source@". +definedIn''' :: (IsChunk q, HasSymbol q, Referable r, HasShortName r) => q -> r -> Sentence definedIn''' q src = ch q `S.is` S "defined in" +:+ refS src -- | Zip helper function enumerates abbreviations and zips it with list of 'ItemType': diff --git a/code/drasil-example/glassbr/lib/Drasil/GlassBR/DataDefs.hs b/code/drasil-example/glassbr/lib/Drasil/GlassBR/DataDefs.hs index 82784d5725..b816bdb768 100644 --- a/code/drasil-example/glassbr/lib/Drasil/GlassBR/DataDefs.hs +++ b/code/drasil-example/glassbr/lib/Drasil/GlassBR/DataDefs.hs @@ -5,7 +5,7 @@ module Drasil.GlassBR.DataDefs (dataDefs, aspRat, glaTyFac, glaTyFacQD, gtfRef, import Control.Lens ((^.)) import Prelude hiding (log, exp, sqrt) -import Drasil.Database (HasUID) +import Drasil.Database (IsChunk) import Language.Drasil import Theory.Drasil (DataDefinition, ddE) import qualified Language.Drasil.Sentence.Combinators as S @@ -150,7 +150,7 @@ gtfRef = definedIn glaTyFac hRef = definedIn' hFromt (S "and is based on the nominal thicknesses") --- Helper -stdVals :: (HasSymbol s, HasUID s) => [s] -> Sentence +stdVals :: (IsChunk s, HasSymbol s) => [s] -> Sentence stdVals s = foldlList Comma List (map ch s) +:+ sent +:+. refS assumpSV where sent = case s of [ ] -> error "stdVals needs quantities" [_] -> S "comes from" diff --git a/code/drasil-example/glassbr/lib/Drasil/GlassBR/IMods.hs b/code/drasil-example/glassbr/lib/Drasil/GlassBR/IMods.hs index bdf59e54fe..832e76a718 100644 --- a/code/drasil-example/glassbr/lib/Drasil/GlassBR/IMods.hs +++ b/code/drasil-example/glassbr/lib/Drasil/GlassBR/IMods.hs @@ -3,7 +3,7 @@ module Drasil.GlassBR.IMods (symb, iMods, pbIsSafe, lrIsSafe, instModIntro) wher import Control.Lens ((^.)) import Prelude hiding (exp) -import Drasil.Database (HasUID) +import Drasil.Database (IsChunk) import Drasil.Sentence.Combinators (definedIn', definedIn) import Language.Drasil import qualified Language.Drasil.Development as D @@ -215,6 +215,6 @@ qHtTlTolRef = definedIn tolPre riskRef = definedIn risk -- Helper -- -interpolating :: (HasUID s, HasSymbol s, Referable f, HasShortName f) => s -> f -> Sentence +interpolating :: (IsChunk s, HasSymbol s, Referable f, HasShortName f) => s -> f -> Sentence interpolating s f = foldlSent [ch s `S.is` S "obtained by interpolating from", plural datum, S "shown" `S.in_` refS f] diff --git a/code/drasil-lang/lib/Language/Drasil/Chunk/NamedIdea.hs b/code/drasil-lang/lib/Language/Drasil/Chunk/NamedIdea.hs index 701a5fa7e0..75ab9f0c32 100644 --- a/code/drasil-lang/lib/Language/Drasil/Chunk/NamedIdea.hs +++ b/code/drasil-lang/lib/Language/Drasil/Chunk/NamedIdea.hs @@ -11,13 +11,13 @@ module Language.Drasil.Chunk.NamedIdea ( import Control.Lens ((^.), makeLenses, Lens') -import Drasil.Database (mkUid, UID, HasUID(..), declareHasChunkRefs, Generically(..)) +import Drasil.Database (mkUid, UID, HasUID(..), declareHasChunkRefs, + Generically(..), IsChunk) import Language.Drasil.NounPhrase.Core (NP) --- TODO: Why does a NamedIdea need a UID? It might need a UID to be registered in the chunk map. --- | A NamedIdea is a 'term' that we've identified (has a 'UID') as --- being worthy of naming. -class HasUID c => NamedIdea c where +-- | A NamedIdea is a 'term' that we've identified (has a 'UID') as being worthy +-- of naming. +class IsChunk c => NamedIdea c where -- | Lens to the term (a noun phrase). term :: Lens' c NP diff --git a/code/drasil-lang/lib/Language/Drasil/Sentence.hs b/code/drasil-lang/lib/Language/Drasil/Sentence.hs index 74bf5bc05b..8ea3afb669 100644 --- a/code/drasil-lang/lib/Language/Drasil/Sentence.hs +++ b/code/drasil-lang/lib/Language/Drasil/Sentence.hs @@ -17,7 +17,7 @@ module Language.Drasil.Sentence ( import Control.Lens ((^.)) import Data.Char (toUpper) -import Drasil.Database (HasChunkRefs(..), HasUID(..), UID) +import Drasil.Database (HasChunkRefs(..), HasUID(..), UID, IsChunk) import Language.Drasil.ExprClasses (Express(express)) import Language.Drasil.ModelExpr.Lang (ModelExpr) @@ -90,7 +90,7 @@ eS' = E . express -- The HasSymbol is redundant, but on purpose -- | Gets a symbol and places it in a 'Sentence'. -ch :: (HasUID c, HasSymbol c) => c -> Sentence +ch :: (IsChunk c, HasSymbol c) => c -> Sentence ch x = SyCh (x ^. uid) -- | Sentences can be concatenated.