Skip to content
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

Moved GenDefn to drasil-theory #1320

Merged
merged 7 commits into from
May 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions code/drasil-database/Database/Drasil/ChunkDB.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module Database.Drasil.ChunkDB
) where

import Language.Drasil hiding (tm, sec)
import Theory.Drasil (GenDefn)

import Control.Lens ((^.), makeLenses)
import Data.List (sortOn)
Expand Down
3 changes: 2 additions & 1 deletion code/drasil-database/drasil-database.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ library
MissingH >= 1.4.0.1,
parsec >= 3.1.9,
data-fix (>= 0.0.4 && <= 1.0),
drasil-lang >= 0.1.60
drasil-lang >= 0.1.60,
drasil-theory >= 0.1.0
default-language: Haskell2010
ghc-options: -Wall -Wredundant-constraints

Expand Down
7 changes: 3 additions & 4 deletions code/drasil-docLang/Drasil/DocumentLanguage.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ import Drasil.DocumentLanguage.Definitions (Fields, ddefn, derivation, instanceM
import Language.Drasil hiding (Manual, Vector, Verb) -- Manual - Citation name conflict. FIXME: Move to different namespace
-- Vector - Name conflict (defined in file)
import Language.Drasil.Utils (sortBySymbol)
import Database.Drasil(SystemInformation(SI), asOrderedList, citeDB,
conceptinsTable, termTable, unitTable, _authors,
_concepts, _kind, _quants, _sys, _sysinfodb,
_usedinfodb)
import Database.Drasil(SystemInformation(SI), asOrderedList, citeDB, conceptinsTable,
termTable, unitTable, _authors, _concepts, _kind, _quants, _sys, _sysinfodb, _usedinfodb)
import Theory.Drasil (GenDefn)

import Control.Lens ((^.), over)
import qualified Data.Map as Map (elems)
Expand Down
16 changes: 8 additions & 8 deletions code/drasil-docLang/Drasil/DocumentLanguage/Definitions.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{-# Language GADTs #-}

module Drasil.DocumentLanguage.Definitions
( Fields
module Drasil.DocumentLanguage.Definitions (
Fields
, Field(..)
, Verbosity(..)
, tmodel
Expand All @@ -11,19 +11,19 @@ module Drasil.DocumentLanguage.Definitions
, InclUnits(..)
, helperRefs
, helpToRefField
)where
) where

import Data.Map (keys)
import Data.List (elem)
import Control.Lens ((^.))

import Language.Drasil
import Database.Drasil(SystemInformation, citeDB,
conceptinsLookup, conceptinsTable, datadefnLookup,
dataDefnTable, gendefLookup, gendefTable,
import Database.Drasil (SystemInformation, citeDB, conceptinsLookup,
conceptinsTable, datadefnLookup, dataDefnTable, gendefLookup, gendefTable,
insmodelLookup, insmodelTable, labelledconLookup, labelledcontentTable,
refbyLookup, refbyTable, sectionLookup, sectionTable,
theoryModelLookup, theoryModelTable, vars, _sysinfodb)
refbyLookup, refbyTable, sectionLookup, sectionTable, theoryModelLookup,
theoryModelTable, vars, _sysinfodb)
import Theory.Drasil (GenDefn)

import Data.Drasil.Utils (eqUnR')
import Data.Drasil.SentenceStructures (SepType(Comma), FoldType(List), foldlList, foldlSent)
Expand Down
9 changes: 4 additions & 5 deletions code/drasil-docLang/Drasil/DocumentLanguage/RefHelpers.hs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{-# Language Rank2Types #-}
module Drasil.DocumentLanguage.RefHelpers
( ModelDB, tmRefDB, gdRefDB, ddRefDB, imRefDB
, mdb, modelsFromDB
) where
module Drasil.DocumentLanguage.RefHelpers (ModelDB, tmRefDB, gdRefDB, ddRefDB,
imRefDB, mdb, modelsFromDB) where

import Language.Drasil
import Database.Drasil(RefMap, simpleMap)
import Database.Drasil (RefMap, simpleMap)
import Theory.Drasil (GenDefn)

import Data.List (sortBy)
import Data.Function (on)
Expand Down
1 change: 1 addition & 0 deletions code/drasil-docLang/Drasil/ExtractDocDesc.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module Drasil.ExtractDocDesc (getDocDesc, egetDocDesc, ciGetDocDesc) where
import Control.Lens((^.))
import Drasil.DocumentLanguage
import Language.Drasil hiding (Manual, Vector, Verb)
import Theory.Drasil (GenDefn)
import Data.List(transpose)

egetDocDesc :: DocDesc -> [Expr]
Expand Down
3 changes: 2 additions & 1 deletion code/drasil-docLang/Drasil/TraceTable.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import Data.Maybe (mapMaybe)

import Language.Drasil
import Language.Drasil.Development (lnames')
import Database.Drasil(TraceMap, traceMap)
import Database.Drasil (TraceMap, traceMap)
import Theory.Drasil (GenDefn)

import Drasil.DocumentLanguage

Expand Down
3 changes: 2 additions & 1 deletion code/drasil-docLang/drasil-docLang.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ library
data-fix (>= 0.0.4 && <= 1.0),
drasil-lang >= 0.1.59,
drasil-data >= 0.1.11,
drasil-database >= 0.1.0
drasil-database >= 0.1.0,
drasil-theory >= 0.1.0
default-language: Haskell2010
ghc-options: -Wall -Wredundant-constraints

Expand Down
1 change: 1 addition & 0 deletions code/drasil-docLang/stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ packages:
- ../drasil-data
- ../drasil-code
- ../drasil-database
- ../drasil-theory
- ./
# Dependency packages to be pulled from upstream that are not in the resolver
# (e.g., acme-missiles-0.3)
Expand Down
1 change: 1 addition & 0 deletions code/drasil-example/Drasil/GamePhysics/Body.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Database.Drasil (ChunkDB, RefbyMap, ReferenceDB, SystemInformation(SI),
TraceMap, ccss, cdb, collectUnits, generateRefbyMap, rdb, refdb, _authors,
_concepts, _constants, _constraints, _datadefs, _definitions, _defSequence,
_inputs, _kind, _outputs, _quants, _sys, _sysinfodb, _usedinfodb)
import Theory.Drasil (GenDefn)

import Drasil.DocLang (DerivationDisplay(..), DocDesc, DocSection(..),
Emphasis(..), Field(..), Fields, InclUnits(IncludeUnits), IntroSec(..),
Expand Down
1 change: 1 addition & 0 deletions code/drasil-example/Drasil/GlassBR/Body.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Database.Drasil (ChunkDB, RefbyMap, ReferenceDB, SystemInformation(SI),
TraceMap, cdb, collectUnits, generateRefbyMap, rdb, refdb, _authors,
_concepts, _constants, _constraints, _datadefs, _definitions, _defSequence,
_inputs, _kind, _outputs, _quants, _sys, _sysinfodb, _usedinfodb)
import Theory.Drasil (GenDefn)

import Drasil.DocLang (AppndxSec(..), AuxConstntSec(..), DerivationDisplay(..),
DocDesc, DocSection(..), Field(..), Fields, GSDSec(GSDProg2), GSDSub(..),
Expand Down
1 change: 1 addition & 0 deletions code/drasil-example/Drasil/NoPCM/Body.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Database.Drasil (Block(Parallel), ChunkDB, RefbyMap, ReferenceDB,
rdb, refdb, _authors, _concepts, _constants, _constraints, _datadefs,
_definitions, _defSequence, _inputs, _kind, _outputs, _quants, _sys,
_sysinfodb, _usedinfodb)
import Theory.Drasil (GenDefn)

import Control.Lens ((^.))
import qualified Data.Map as Map
Expand Down
3 changes: 2 additions & 1 deletion code/drasil-example/Drasil/NoPCM/GenDefs.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module Drasil.NoPCM.GenDefs (rocTempSimp, swhsGDs) where

import Language.Drasil
import Theory.Drasil (GenDefn, gd)

import Data.Drasil.Concepts.Math (rOfChng, unit_)
import Data.Drasil.Concepts.Thermodynamics (temp)
Expand All @@ -27,7 +28,7 @@ swhsGDs :: [GenDefn]
swhsGDs = [nwtnCooling, rocTempSimp]

rocTempSimp :: GenDefn
rocTempSimp = gd' rocTempSimpRC (Nothing :: Maybe UnitDefn) roc_temp_simp_deriv
rocTempSimp = gd rocTempSimpRC (Nothing :: Maybe UnitDefn) roc_temp_simp_deriv
[{-S "FIXME: no sources"-}] "rocTempSimp" [rocTempSimp_desc]

roc_temp_simp_deriv :: Derivation
Expand Down
1 change: 1 addition & 0 deletions code/drasil-example/Drasil/SSP/Body.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Database.Drasil (Block(Parallel), ChunkDB, RefbyMap, ReferenceDB,
rdb, refdb, _authors, _concepts, _constants, _constraints, _datadefs,
_definitions, _defSequence, _inputs, _kind, _outputs, _quants, _sys,
_sysinfodb, _usedinfodb)
import Theory.Drasil (GenDefn)

import Control.Lens ((^.))
import Prelude hiding (sin, cos, tan)
Expand Down
19 changes: 10 additions & 9 deletions code/drasil-example/Drasil/SSP/GenDefs.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module Drasil.SSP.GenDefs (normForcEq, bsShrFEq, resShr, mobShr,

import Prelude hiding (sin, cos, tan)
import Language.Drasil
import Theory.Drasil (GenDefn, gd)

import Drasil.DocLang.SRS as SRS (physSyst)

Expand Down Expand Up @@ -42,23 +43,23 @@ generalDefinitions = [normForcEqGD, bsShrFEqGD, resShrGD, mobShrGD,
effNormFGD, resShearWOGD, mobShearWOGD, normShrRGD, momentEqlGD]

normForcEqGD, bsShrFEqGD, resShrGD, mobShrGD, effNormFGD, resShearWOGD, mobShearWOGD, normShrRGD, momentEqlGD :: GenDefn
normForcEqGD = gd' normForcEq (getUnit totNrmForce) [nmFEq_deriv]
normForcEqGD = gd normForcEq (getUnit totNrmForce) [nmFEq_deriv]
[makeCite chen2005] "normForcEq" [nmFEq_desc]
bsShrFEqGD = gd' bsShrFEq (getUnit mobShrI) [bShFEq_deriv]
bsShrFEqGD = gd bsShrFEq (getUnit mobShrI) [bShFEq_deriv]
[makeCite chen2005] "bsShrFEq" [bShFEq_desc]
resShrGD = gd' resShr (getUnit shrResI) [resShr_deriv]
resShrGD = gd resShr (getUnit shrResI) [resShr_deriv]
[makeCite chen2005] "resShr" [resShr_desc]
mobShrGD = gd' mobShr (getUnit mobShrI) [mobShr_deriv]
mobShrGD = gd mobShr (getUnit mobShrI) [mobShr_deriv]
[makeCite chen2005] "mobShr" [mobShr_desc]
effNormFGD = gd' effNormF (getUnit nrmFSubWat) [effNormF_deriv]
effNormFGD = gd effNormF (getUnit nrmFSubWat) [effNormF_deriv]
[makeCite chen2005] "effNormF" [effNormF_desc]
resShearWOGD = gd' resShearWO (getUnit shearRNoIntsl) []
resShearWOGD = gd resShearWO (getUnit shearRNoIntsl) []
(map makeCite[chen2005, karchewski2012]) "resShearWO" [resShearWO_desc]
mobShearWOGD = gd' mobShearWO (getUnit shearFNoIntsl) []
mobShearWOGD = gd mobShearWO (getUnit shearFNoIntsl) []
(map makeCite[chen2005, karchewski2012]) "mobShearWO" [mobShearWO_desc]
normShrRGD = gd' normShrR (getUnit intShrForce) []
normShrRGD = gd normShrR (getUnit intShrForce) []
[makeCite chen2005] "normShrR" [nmShrR_desc]
momentEqlGD = gd' momentEql (Just newton) [momEql_deriv]
momentEqlGD = gd momentEql (Just newton) [momEql_deriv]
[makeCite chen2005] "momentEql" [momEql_desc]

--
Expand Down
1 change: 1 addition & 0 deletions code/drasil-example/Drasil/SWHS/Body.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Database.Drasil (Block, ChunkDB, RefbyMap, ReferenceDB,
getIdeaDict, rdb, refdb, _authors, _concepts, _constants, _constraints,
_datadefs, _definitions, _defSequence, _inputs, _kind, _outputs, _quants,
_sys, _sysinfodb, _usedinfodb)
import Theory.Drasil (GenDefn)

import Control.Lens ((^.))
import qualified Data.Map as Map
Expand Down
5 changes: 3 additions & 2 deletions code/drasil-example/Drasil/SWHS/GenDefs.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module Drasil.SWHS.GenDefs (swhsGDs, nwtnCooling, rocTempSimp,
import Prelude hiding (sin, cos, tan)

import Language.Drasil
import Theory.Drasil (GenDefn, gd)

import Data.Drasil.Concepts.Math (equation, rate, rOfChng, unit_)
import Data.Drasil.Concepts.Thermodynamics (lawConvCooling)
Expand Down Expand Up @@ -40,10 +41,10 @@ swhsGDs = [nwtnCooling, rocTempSimp]

-- FIXME: page reference
nwtnCooling, rocTempSimp :: GenDefn
nwtnCooling = gd' nwtnCoolingRC (Just thermalFlux) ([] :: Derivation)
nwtnCooling = gd nwtnCoolingRC (Just thermalFlux) ([] :: Derivation)
[makeCite incroperaEtAl2007 {- +:+ sParen (S "pg. 8") -}] "nwtnCooling" [nwtnCooling_desc]

rocTempSimp = gd' rocTempSimpRC (Nothing :: Maybe UnitDefn) roc_temp_simp_deriv [] -- FIXME: no sources
rocTempSimp = gd rocTempSimpRC (Nothing :: Maybe UnitDefn) roc_temp_simp_deriv [] -- FIXME: no sources
"rocTempSimp" [rocTempSimp_desc]

--
Expand Down
15 changes: 10 additions & 5 deletions code/drasil-example/drasil-example.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ executable glassbr
drasil-database >= 0.1.0,
drasil-printers >= 0.1.8,
drasil-gen >= 0.1.3,
drasil-docLang >= 0.1.23
drasil-docLang >= 0.1.23,
drasil-theory >= 0.1.0
default-language: Haskell2010
ghc-options: -Wall -Wredundant-constraints

Expand Down Expand Up @@ -109,7 +110,8 @@ executable nopcm
drasil-database >= 0.1.0,
drasil-printers >= 0.1.8,
drasil-gen >= 0.1.3,
drasil-docLang >= 0.1.23
drasil-docLang >= 0.1.23,
drasil-theory >= 0.1.0
default-language: Haskell2010
ghc-options: -Wall -Wredundant-constraints

Expand Down Expand Up @@ -146,7 +148,8 @@ executable swhs
drasil-database >= 0.1.0,
drasil-printers >= 0.1.8,
drasil-gen >= 0.1.3,
drasil-docLang >= 0.1.23
drasil-docLang >= 0.1.23,
drasil-theory >= 0.1.0
default-language: Haskell2010
ghc-options: -Wall -Wredundant-constraints

Expand Down Expand Up @@ -185,7 +188,8 @@ executable ssp
drasil-database >= 0.1.0,
drasil-printers >= 0.1.8,
drasil-gen >= 0.1.3,
drasil-docLang >= 0.1.23
drasil-docLang >= 0.1.23,
drasil-theory >= 0.1.0
default-language: Haskell2010
ghc-options: -Wall -Wredundant-constraints

Expand Down Expand Up @@ -218,7 +222,8 @@ executable chipmunkdocs
drasil-database >= 0.1.0,
drasil-printers >= 0.1.8,
drasil-gen >= 0.1.3,
drasil-docLang >= 0.1.23
drasil-docLang >= 0.1.23,
drasil-theory >= 0.1.0
default-language: Haskell2010
ghc-options: -Wall -Wredundant-constraints

Expand Down
1 change: 1 addition & 0 deletions code/drasil-example/stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ packages:
- ../drasil-gen
- ../drasil-docLang
- ../drasil-database
- ../drasil-theory
- ./
# Dependency packages to be pulled from upstream that are not in the resolver
# (e.g., acme-missiles-0.3)
Expand Down
9 changes: 3 additions & 6 deletions code/drasil-lang/Language/Drasil.hs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ module Language.Drasil (
-- Chunk.Concept.Core
, sDom
-- Chunk.CommonIdea
, commonIdea, CI, getAcc, getAccStr, commonIdeaWithDict
, commonIdea, CI, getAcc, getAccStr, commonIdeaWithDict, prependAbrv
-- Chunk.NamedIdea
, NamedChunk, short, nc, IdeaDict , mkIdea
, nw -- bad name (historical)
Expand All @@ -66,8 +66,6 @@ module Language.Drasil (
, QDefinition, fromEqn, fromEqn', equat, ec
-- Chunk.DataDefinition
, DataDefinition, mkQuantDef, mkDD, qdFromDD
-- Chunk.GenDefn
, GenDefn, gd', gd''
-- Chunk.InstanceModel
, InstanceModel
, inCons, outCons, imOutput, imInputs, im', im''
Expand Down Expand Up @@ -149,7 +147,7 @@ module Language.Drasil (
-- Reference
, makeRef2S, makeCite, makeCiteS, makeRef2
-- Label.Type
, getAdd
, getAdd, prepend
, LblType(RP, Citation, URI), IRefProg(..)
-- Development.Sentence
, introduceAbb, phrase, plural, phrase's, plural's, at_start, at_start'
Expand Down Expand Up @@ -242,7 +240,6 @@ import Language.Drasil.Constraint (physc, sfwrc, enumc, isPhysC, isSfwrC,
import Language.Drasil.Chunk.DefinedQuantity
import Language.Drasil.Chunk.Eq (QDefinition, fromEqn, fromEqn', equat, ec)
import Language.Drasil.Chunk.DataDefinition (DataDefinition, mkQuantDef, mkDD, qdFromDD)
import Language.Drasil.Chunk.GenDefn
import Language.Drasil.Chunk.InstanceModel
import Language.Drasil.Chunk.NamedIdea
import Language.Drasil.Chunk.Quantity
Expand Down Expand Up @@ -280,7 +277,7 @@ import Language.Drasil.People (People, Person, person, HasName(..), manyNames
, person', personWM, personWM', mononym, name, nameStr, rendPersLFM,
rendPersLFM', rendPersLFM'', comparePeople)
import Language.Drasil.RefProg(Reference(Reference))
import Language.Drasil.Label.Type (getAdd, LblType(RP, Citation, URI), IRefProg(..))
import Language.Drasil.Label.Type (getAdd, LblType(RP, Citation, URI), IRefProg(..), prepend)

import Language.Drasil.UnitLang (USymb(US))
import Language.Drasil.Uncertainty.Core(Uncertainty, uncty)
Expand Down
11 changes: 4 additions & 7 deletions code/drasil-lang/Language/Drasil/Chunk/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
----------------------------------------------------------
### Quick Summary of Folder Structure and File Contents
Last updated: May 1, 2019
Last updated: May 13, 2019
----------------------------------------------------------

**Concept**
Expand All @@ -20,19 +20,16 @@ Constrained.hs
- Defines ConstrainedChunk and ConstrConcept data types

DataDefinition.hs
- Defines DataDefinition data type and constructors
- Defines DataDefinition data type and constructors *TODO: Move from drasil-lang to drasil-theory*

DefinedQuantity.hs
- Defines DefinedQuantityDict data type and constructors

Eq.hs
- Defines QDefinition data type (quantity with units and defining equations)

GenDefn.hs
- General Definition chunks *TODO: Move from drasil-lang to drasil-docLang*

InstanceModel.hs
- Instance model chunks *TODO: Move from drasil-lang to drasil-docLang*
- Instance model chunks *TODO: Move from drasil-lang to drasil-theory*

NamedIdea.hs
- NamedChunk and IdeaDict data types
Expand All @@ -50,7 +47,7 @@ Relation.hs

Theory.hs
- `Theory` class definition
- TheoryChunk and TheoryModel data types *TODO: Move from drasil-lang to drasil-docLang*
- TheoryChunk and TheoryModel data types *TODO: Move from drasil-lang to drasil-theory*

UncertainQuantity.hs
- `UncertainQuantity` class definition
Expand Down
1 change: 0 additions & 1 deletion code/drasil-lang/drasil-lang.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ library
, Language.Drasil.Chunk.DataDefinition
, Language.Drasil.Chunk.DefinedQuantity
, Language.Drasil.Chunk.Eq
, Language.Drasil.Chunk.GenDefn
, Language.Drasil.Chunk.InstanceModel
, Language.Drasil.Chunk.NamedIdea
, Language.Drasil.Chunk.Quantity
Expand Down
Loading