{-# OPTIONS_GHC -Wno-redundant-constraints #-}
module Language.Drasil.Printing.Import.ExprCommon (
parens,
lookupC, lookupC', lookupSymb
) where
import Control.Lens ((^.))
import Drasil.Database (UID, ChunkDB, findOrErr, UIDRef, IsChunk, raw)
import Language.Drasil (Stage(..), codeSymb, eqSymb, Symbol, HasSymbol,
DefinedQuantityDict)
import qualified Language.Drasil.Printing.AST as P
import Language.Drasil.Printing.PrintingInformation (PrintingInformation, stg, sysdb)
parens :: P.Expr -> P.Expr
parens :: Expr -> Expr
parens = Fence -> Fence -> Expr -> Expr
P.Fenced Fence
P.Paren Fence
P.Paren
lookupC :: Stage -> ChunkDB -> UID -> Symbol
lookupC :: Stage -> ChunkDB -> UID -> Symbol
lookupC Stage
Equational ChunkDB
sm UID
c = DefinedQuantityDict -> Symbol
forall q. HasSymbol q => q -> Symbol
eqSymb (UID -> ChunkDB -> DefinedQuantityDict
forall a. Typeable a => UID -> ChunkDB -> a
findOrErr UID
c ChunkDB
sm :: DefinedQuantityDict)
lookupC Stage
Implementation ChunkDB
sm UID
c = DefinedQuantityDict -> Symbol
forall q. HasSymbol q => q -> Symbol
codeSymb (UID -> ChunkDB -> DefinedQuantityDict
forall a. Typeable a => UID -> ChunkDB -> a
findOrErr UID
c ChunkDB
sm :: DefinedQuantityDict)
lookupC' :: PrintingInformation -> UID -> Symbol
lookupC' :: PrintingInformation -> UID -> Symbol
lookupC' PrintingInformation
pinfo = Stage -> ChunkDB -> UID -> Symbol
lookupC (PrintingInformation
pinfo PrintingInformation
-> Getting Stage PrintingInformation Stage -> Stage
forall s a. s -> Getting a s a -> a
^. Getting Stage PrintingInformation Stage
Lens' PrintingInformation Stage
stg) (PrintingInformation
pinfo PrintingInformation
-> Getting ChunkDB PrintingInformation ChunkDB -> ChunkDB
forall s a. s -> Getting a s a -> a
^. Getting ChunkDB PrintingInformation ChunkDB
Lens' PrintingInformation ChunkDB
sysdb)
lookupSymb :: (IsChunk t, HasSymbol t) => PrintingInformation -> UIDRef t -> Symbol
lookupSymb :: forall t.
(IsChunk t, HasSymbol t) =>
PrintingInformation -> UIDRef t -> Symbol
lookupSymb PrintingInformation
pinfo UIDRef t
u = Stage -> DefinedQuantityDict -> Symbol
forall {q}. HasSymbol q => Stage -> q -> Symbol
sytyF (PrintingInformation
pinfo PrintingInformation
-> Getting Stage PrintingInformation Stage -> Stage
forall s a. s -> Getting a s a -> a
^. Getting Stage PrintingInformation Stage
Lens' PrintingInformation Stage
stg) (UID -> ChunkDB -> DefinedQuantityDict
forall a. Typeable a => UID -> ChunkDB -> a
findOrErr (UIDRef t -> UID
forall {k} (t :: k). UIDRef t -> UID
raw UIDRef t
u) (PrintingInformation
pinfo PrintingInformation
-> Getting ChunkDB PrintingInformation ChunkDB -> ChunkDB
forall s a. s -> Getting a s a -> a
^. Getting ChunkDB PrintingInformation ChunkDB
Lens' PrintingInformation ChunkDB
sysdb) :: DefinedQuantityDict)
where sytyF :: Stage -> q -> Symbol
sytyF Stage
Equational = q -> Symbol
forall q. HasSymbol q => q -> Symbol
eqSymb
sytyF Stage
Implementation = q -> Symbol
forall q. HasSymbol q => q -> Symbol
codeSymb