module Drasil.GlassBR.Symbols where

import Language.Drasil (DefinedQuantityDict, dqdWr, cnstrw')
import Language.Drasil.Code (Mod(Mod), asVC)

import Drasil.GlassBR.ModuleDefs (allMods, implVars)
import Drasil.GlassBR.Unitals (specParamVals, modElas,
  tmSymbols, interps, derivedInputDataConstraints, unitless, probBr,
  stressDistFac, nomThick, sdVector, inputsWUnitsUncrtn, inputsWUncrtn,
  glassTypeCon, unitalSymbols)

import Data.List ((\\))

symbolsForSymbolTable :: [DefinedQuantityDict]
symbolsForSymbolTable :: [DefinedQuantityDict]
symbolsForSymbolTable = [DefinedQuantityDict]
symbolsForTermTable [DefinedQuantityDict]
-> [DefinedQuantityDict] -> [DefinedQuantityDict]
forall a. [a] -> [a] -> [a]
++ (UnitalChunk -> DefinedQuantityDict)
-> [UnitalChunk] -> [DefinedQuantityDict]
forall a b. (a -> b) -> [a] -> [b]
map UnitalChunk -> DefinedQuantityDict
forall c.
(Quantity c, Concept c, MayHaveUnit c) =>
c -> DefinedQuantityDict
dqdWr [UnitalChunk]
unitalSymbols [DefinedQuantityDict]
-> [DefinedQuantityDict] -> [DefinedQuantityDict]
forall a. [a] -> [a] -> [a]
++
  [DefinedQuantityDict]
unitless [DefinedQuantityDict]
-> [DefinedQuantityDict] -> [DefinedQuantityDict]
forall a. [a] -> [a] -> [a]
++ (ConstrConcept -> DefinedQuantityDict)
-> [ConstrConcept] -> [DefinedQuantityDict]
forall a b. (a -> b) -> [a] -> [b]
map ConstrConcept -> DefinedQuantityDict
forall c.
(Quantity c, Concept c, MayHaveUnit c) =>
c -> DefinedQuantityDict
dqdWr [ConstrConcept
probBr, ConstrConcept
stressDistFac, ConstrConcept -> ConstrConcept
forall c.
(Quantity c, Concept c, Constrained c, HasReasVal c,
 MayHaveUnit c) =>
c -> ConstrConcept
cnstrw' ConstrConcept
nomThick, ConstrConcept -> ConstrConcept
forall c.
(Quantity c, Concept c, Constrained c, HasReasVal c,
 MayHaveUnit c) =>
c -> ConstrConcept
cnstrw' ConstrConcept
glassTypeCon] [DefinedQuantityDict]
-> [DefinedQuantityDict] -> [DefinedQuantityDict]
forall a. [a] -> [a] -> [a]
++
  (UncertQ -> DefinedQuantityDict)
-> [UncertQ] -> [DefinedQuantityDict]
forall a b. (a -> b) -> [a] -> [b]
map UncertQ -> DefinedQuantityDict
forall c.
(Quantity c, Concept c, MayHaveUnit c) =>
c -> DefinedQuantityDict
dqdWr [UncertQ]
derivedInputDataConstraints

symbolsForTermTable :: [DefinedQuantityDict]
symbolsForTermTable :: [DefinedQuantityDict]
symbolsForTermTable = (UncertQ -> DefinedQuantityDict)
-> [UncertQ] -> [DefinedQuantityDict]
forall a b. (a -> b) -> [a] -> [b]
map UncertQ -> DefinedQuantityDict
forall c.
(Quantity c, Concept c, MayHaveUnit c) =>
c -> DefinedQuantityDict
dqdWr [UncertQ]
inputsWUnitsUncrtn [DefinedQuantityDict]
-> [DefinedQuantityDict] -> [DefinedQuantityDict]
forall a. [a] -> [a] -> [a]
++ (UncertQ -> DefinedQuantityDict)
-> [UncertQ] -> [DefinedQuantityDict]
forall a b. (a -> b) -> [a] -> [b]
map UncertQ -> DefinedQuantityDict
forall c.
(Quantity c, Concept c, MayHaveUnit c) =>
c -> DefinedQuantityDict
dqdWr [UncertQ]
inputsWUncrtn [DefinedQuantityDict]
-> [DefinedQuantityDict] -> [DefinedQuantityDict]
forall a. [a] -> [a] -> [a]
++
  (UnitalChunk -> DefinedQuantityDict)
-> [UnitalChunk] -> [DefinedQuantityDict]
forall a b. (a -> b) -> [a] -> [b]
map UnitalChunk -> DefinedQuantityDict
forall c.
(Quantity c, Concept c, MayHaveUnit c) =>
c -> DefinedQuantityDict
dqdWr [UnitalChunk]
sdVector [DefinedQuantityDict]
-> [DefinedQuantityDict] -> [DefinedQuantityDict]
forall a. [a] -> [a] -> [a]
++ [DefinedQuantityDict]
tmSymbols [DefinedQuantityDict]
-> [DefinedQuantityDict] -> [DefinedQuantityDict]
forall a. [a] -> [a] -> [a]
++ (ConstQDef -> DefinedQuantityDict)
-> [ConstQDef] -> [DefinedQuantityDict]
forall a b. (a -> b) -> [a] -> [b]
map ConstQDef -> DefinedQuantityDict
forall c.
(Quantity c, Concept c, MayHaveUnit c) =>
c -> DefinedQuantityDict
dqdWr [ConstQDef]
specParamVals [DefinedQuantityDict]
-> [DefinedQuantityDict] -> [DefinedQuantityDict]
forall a. [a] -> [a] -> [a]
++ 
  [UnitalChunk -> DefinedQuantityDict
forall c.
(Quantity c, Concept c, MayHaveUnit c) =>
c -> DefinedQuantityDict
dqdWr UnitalChunk
modElas] [DefinedQuantityDict]
-> [DefinedQuantityDict] -> [DefinedQuantityDict]
forall a. [a] -> [a] -> [a]
++ [DefinedQuantityDict]
interps

  -- include all module functions as symbols
thisSymbols :: [DefinedQuantityDict]
thisSymbols :: [DefinedQuantityDict]
thisSymbols = ((Func -> DefinedQuantityDict) -> [Func] -> [DefinedQuantityDict]
forall a b. (a -> b) -> [a] -> [b]
map Func -> DefinedQuantityDict
asVC ((Mod -> [Func]) -> [Mod] -> [Func]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\(Mod Name
_ Name
_ [Name]
_ [Class]
_ [Func]
l) -> [Func]
l) [Mod]
allMods)
  [DefinedQuantityDict]
-> [DefinedQuantityDict] -> [DefinedQuantityDict]
forall a. Eq a => [a] -> [a] -> [a]
\\ [DefinedQuantityDict]
symbolsForSymbolTable) [DefinedQuantityDict]
-> [DefinedQuantityDict] -> [DefinedQuantityDict]
forall a. [a] -> [a] -> [a]
++ [DefinedQuantityDict]
implVars [DefinedQuantityDict]
-> [DefinedQuantityDict] -> [DefinedQuantityDict]
forall a. [a] -> [a] -> [a]
++ [DefinedQuantityDict]
symbolsForSymbolTable
  
thisTerms :: [DefinedQuantityDict]
thisTerms :: [DefinedQuantityDict]
thisTerms = ((Func -> DefinedQuantityDict) -> [Func] -> [DefinedQuantityDict]
forall a b. (a -> b) -> [a] -> [b]
map Func -> DefinedQuantityDict
asVC ((Mod -> [Func]) -> [Mod] -> [Func]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\(Mod Name
_ Name
_ [Name]
_ [Class]
_ [Func]
l) -> [Func]
l) [Mod]
allMods)
  [DefinedQuantityDict]
-> [DefinedQuantityDict] -> [DefinedQuantityDict]
forall a. Eq a => [a] -> [a] -> [a]
\\ [DefinedQuantityDict]
symbolsForTermTable) [DefinedQuantityDict]
-> [DefinedQuantityDict] -> [DefinedQuantityDict]
forall a. [a] -> [a] -> [a]
++ [DefinedQuantityDict]
implVars [DefinedQuantityDict]
-> [DefinedQuantityDict] -> [DefinedQuantityDict]
forall a. [a] -> [a] -> [a]
++ [DefinedQuantityDict]
symbolsForTermTable