Skip to content

Commit cb5018b

Browse files
Merge pull request #4725 from JacquesCarette/switchChIsChunkNoUID
Switch `ch` `Sentence` constructor from using `HasUID` to `IsChunk`.
2 parents 92360d5 + 6eff769 commit cb5018b

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

code/drasil-docLang/lib/Drasil/Sentence/Combinators.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ import Control.Lens ((^.))
2323
import Data.Decimal (DecimalRaw, realFracToDecimal)
2424
import Data.List (transpose)
2525

26-
import Drasil.Database (HasUID)
27-
26+
import Drasil.Database (IsChunk)
2827
import Language.Drasil (ConceptChunk, DefinesQuantity(defLhs) , UnitDefn, MayHaveUnit(..)
2928
, UnitalChunk , HasUnitSymbol(usymb), Quantity, Concept, Definition(defn), NamedIdea(..)
3029
, HasSymbol
@@ -66,8 +65,9 @@ definedIn' q info = ch (q ^. defLhs) `S.is` S "defined" `S.in_` refS q +:+. info
6665
definedIn'' :: (Referable r, HasShortName r) => r -> Sentence
6766
definedIn'' q = S "defined" `S.in_` refS q
6867

69-
-- | Takes a 'Symbol' and its 'Reference' (does not append a period at the end!). Outputs as "@symbol@ is defined in @source@".
70-
definedIn''' :: (HasSymbol q, HasUID q, Referable r, HasShortName r) => q -> r -> Sentence
68+
-- | Takes a 'Symbol' and its 'Reference' (does not append a period at the
69+
-- end!). Outputs as "@symbol@ is defined in @source@".
70+
definedIn''' :: (IsChunk q, HasSymbol q, Referable r, HasShortName r) => q -> r -> Sentence
7171
definedIn''' q src = ch q `S.is` S "defined in" +:+ refS src
7272

7373
-- | Zip helper function enumerates abbreviations and zips it with list of 'ItemType':

code/drasil-example/glassbr/lib/Drasil/GlassBR/DataDefs.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module Drasil.GlassBR.DataDefs (dataDefs, aspRat, glaTyFac, glaTyFacQD, gtfRef,
55
import Control.Lens ((^.))
66
import Prelude hiding (log, exp, sqrt)
77

8-
import Drasil.Database (HasUID)
8+
import Drasil.Database (IsChunk)
99
import Language.Drasil
1010
import Theory.Drasil (DataDefinition, ddE)
1111
import qualified Language.Drasil.Sentence.Combinators as S
@@ -150,7 +150,7 @@ gtfRef = definedIn glaTyFac
150150
hRef = definedIn' hFromt (S "and is based on the nominal thicknesses")
151151

152152
--- Helper
153-
stdVals :: (HasSymbol s, HasUID s) => [s] -> Sentence
153+
stdVals :: (IsChunk s, HasSymbol s) => [s] -> Sentence
154154
stdVals s = foldlList Comma List (map ch s) +:+ sent +:+. refS assumpSV
155155
where sent = case s of [ ] -> error "stdVals needs quantities"
156156
[_] -> S "comes from"

code/drasil-example/glassbr/lib/Drasil/GlassBR/IMods.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module Drasil.GlassBR.IMods (symb, iMods, pbIsSafe, lrIsSafe, instModIntro) wher
33
import Control.Lens ((^.))
44
import Prelude hiding (exp)
55

6-
import Drasil.Database (HasUID)
6+
import Drasil.Database (IsChunk)
77
import Drasil.Sentence.Combinators (definedIn', definedIn)
88
import Language.Drasil
99
import qualified Language.Drasil.Development as D
@@ -215,6 +215,6 @@ qHtTlTolRef = definedIn tolPre
215215
riskRef = definedIn risk
216216

217217
-- Helper --
218-
interpolating :: (HasUID s, HasSymbol s, Referable f, HasShortName f) => s -> f -> Sentence
218+
interpolating :: (IsChunk s, HasSymbol s, Referable f, HasShortName f) => s -> f -> Sentence
219219
interpolating s f = foldlSent [ch s `S.is` S "obtained by interpolating from",
220220
plural datum, S "shown" `S.in_` refS f]

code/drasil-lang/lib/Language/Drasil/Chunk/NamedIdea.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ module Language.Drasil.Chunk.NamedIdea (
1111

1212
import Control.Lens ((^.), makeLenses, Lens')
1313

14-
import Drasil.Database (mkUid, UID, HasUID(..), declareHasChunkRefs, Generically(..))
14+
import Drasil.Database (mkUid, UID, HasUID(..), declareHasChunkRefs,
15+
Generically(..), IsChunk)
1516
import Language.Drasil.NounPhrase.Core (NP)
1617

17-
-- TODO: Why does a NamedIdea need a UID? It might need a UID to be registered in the chunk map.
18-
-- | A NamedIdea is a 'term' that we've identified (has a 'UID') as
19-
-- being worthy of naming.
20-
class HasUID c => NamedIdea c where
18+
-- | A NamedIdea is a 'term' that we've identified (has a 'UID') as being worthy
19+
-- of naming.
20+
class IsChunk c => NamedIdea c where
2121
-- | Lens to the term (a noun phrase).
2222
term :: Lens' c NP
2323

code/drasil-lang/lib/Language/Drasil/Sentence.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module Language.Drasil.Sentence (
1717
import Control.Lens ((^.))
1818
import Data.Char (toUpper)
1919

20-
import Drasil.Database (HasChunkRefs(..), HasUID(..), UID)
20+
import Drasil.Database (HasChunkRefs(..), HasUID(..), UID, IsChunk)
2121

2222
import Language.Drasil.ExprClasses (Express(express))
2323
import Language.Drasil.ModelExpr.Lang (ModelExpr)
@@ -90,7 +90,7 @@ eS' = E . express
9090

9191
-- The HasSymbol is redundant, but on purpose
9292
-- | Gets a symbol and places it in a 'Sentence'.
93-
ch :: (HasUID c, HasSymbol c) => c -> Sentence
93+
ch :: (IsChunk c, HasSymbol c) => c -> Sentence
9494
ch x = SyCh (x ^. uid)
9595

9696
-- | Sentences can be concatenated.

0 commit comments

Comments
 (0)