module Language.Drasil.Log.Print where
import Language.Drasil hiding (symbol)
import Language.Drasil.Development (showUID)
import qualified Language.Drasil as L (symbol)
import Database.Drasil
import Utils.Drasil (stringList)
import qualified Data.Map as Map
import Control.Lens ((^.), view)
import Data.List (nub, sort, sortBy)
import Data.Maybe (fromMaybe)
import Data.Bifunctor (second)
import Data.Function (on)
import Text.PrettyPrint.HughesPJ
import Language.Drasil.Plain.Print
import Language.Drasil.Printing.PrintingInformation
import Prelude hiding ((<>))
printAllDebugInfo :: PrintingInformation -> [Doc]
printAllDebugInfo :: PrintingInformation -> [Doc]
printAllDebugInfo pinfo :: PrintingInformation
pinfo = ((PrintingInformation -> Doc) -> Doc)
-> [PrintingInformation -> Doc] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (Doc -> Doc
cdbSection (Doc -> Doc)
-> ((PrintingInformation -> Doc) -> Doc)
-> (PrintingInformation -> Doc)
-> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((PrintingInformation -> Doc) -> PrintingInformation -> Doc
forall a b. (a -> b) -> a -> b
$ PrintingInformation
pinfo)) [PrintingInformation -> Doc
mkTableReferencedChunks, PrintingInformation -> Doc
mkTableDepChunks, PrintingInformation -> Doc
mkTableDepReffedChunks,
PrintingInformation -> Doc
mkTableSymb, PrintingInformation -> Doc
mkTableOfTerms, PrintingInformation -> Doc
mkTableConcepts, PrintingInformation -> Doc
mkTableUnitDefn,
PrintingInformation -> Doc
mkTableDataDef, PrintingInformation -> Doc
mkTableGenDef, PrintingInformation -> Doc
mkTableTMod, PrintingInformation -> Doc
mkTableIMod, PrintingInformation -> Doc
mkTableCI,
PrintingInformation -> Doc
mkTableSec, PrintingInformation -> Doc
mkTableLC, PrintingInformation -> Doc
mkTableRef, [(UID, String)] -> Doc
renderUsedUIDs ([(UID, String)] -> Doc)
-> (PrintingInformation -> [(UID, String)])
-> PrintingInformation
-> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PrintingInformation -> [(UID, String)]
mkListShowUsedUIDs]
cdbSection :: Doc -> Doc
cdbSection :: Doc -> Doc
cdbSection dd :: Doc
dd = String -> Doc
text (Int -> Char -> String
forall a. Int -> a -> [a]
replicate 100 '#' String -> String -> String
forall a. [a] -> [a] -> [a]
++ "\n") Doc -> Doc -> Doc
$$ Doc
dd Doc -> Doc -> Doc
$$ String -> Doc
text "\n"
header :: Doc -> Doc
d :: Doc
d = String -> Doc
text (Int -> Char -> String
forall a. Int -> a -> [a]
replicate 100 '-') Doc -> Doc -> Doc
$$ Doc
d Doc -> Doc -> Doc
$$ String -> Doc
text (Int -> Char -> String
forall a. Int -> a -> [a]
replicate 100 '-')
mkTableFromLenses :: PrintingInformation -> (ChunkDB -> UMap a)
-> String -> String -> String -> String -> (a -> Doc) -> (a -> Doc) -> (a -> Doc) -> Doc
mkTableFromLenses :: PrintingInformation
-> (ChunkDB -> UMap a)
-> String
-> String
-> String
-> String
-> (a -> Doc)
-> (a -> Doc)
-> (a -> Doc)
-> Doc
mkTableFromLenses PI{_ckdb :: PrintingInformation -> ChunkDB
_ckdb = ChunkDB
db} tableLens :: ChunkDB -> UMap a
tableLens ttle :: String
ttle h1 :: String
h1 h2 :: String
h2 h3 :: String
h3 l1 :: a -> Doc
l1 l2 :: a -> Doc
l2 l3 :: a -> Doc
l3 =
String -> Doc
text String
ttle Doc -> Doc -> Doc
<> Doc
colon
Doc -> Doc -> Doc
$$ Doc -> Doc
header (String -> Doc
text String
h1 Doc -> Doc -> Doc
$$ Int -> Doc -> Doc
nest Int
nestNum (String -> Doc
text String
h2) Doc -> Doc -> Doc
$$ Int -> Doc -> Doc
nest (Int
nestNumInt -> Int -> Int
forall a. Num a => a -> a -> a
*3) (String -> Doc
text String
h3))
Doc -> Doc -> Doc
$$ [Doc] -> Doc
vcat ((a -> Doc) -> [a] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map a -> Doc
chunkLayout [a]
chunks)
where
chunkLayout :: a -> Doc
chunkLayout x :: a
x = a -> Doc
l1 a
x Doc -> Doc -> Doc
$$ Int -> Doc -> Doc
nest Int
nestNum (a -> Doc
l2 a
x)
Doc -> Doc -> Doc
$$ Int -> Doc -> Doc
nest (Int
nestNumInt -> Int -> Int
forall a. Num a => a -> a -> a
*3) (a -> Doc
l3 a
x)
chunks :: [a]
chunks = ((UID, (a, Int)) -> a) -> [(UID, (a, Int))] -> [a]
forall a b. (a -> b) -> [a] -> [b]
map ((a, Int) -> a
forall a b. (a, b) -> a
fst((a, Int) -> a)
-> ((UID, (a, Int)) -> (a, Int)) -> (UID, (a, Int)) -> a
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(UID, (a, Int)) -> (a, Int)
forall a b. (a, b) -> b
snd) (UMap a -> [(UID, (a, Int))]
forall k a. Map k a -> [(k, a)]
Map.assocs (UMap a -> [(UID, (a, Int))]) -> UMap a -> [(UID, (a, Int))]
forall a b. (a -> b) -> a -> b
$ ChunkDB -> UMap a
tableLens ChunkDB
db)
nestNum :: Int
nestNum = 30
mkTableSymb :: PrintingInformation -> Doc
mkTableSymb :: PrintingInformation -> Doc
mkTableSymb pinfo :: PrintingInformation
pinfo = PrintingInformation
-> (ChunkDB -> UMap QuantityDict)
-> String
-> String
-> String
-> String
-> (QuantityDict -> Doc)
-> (QuantityDict -> Doc)
-> (QuantityDict -> Doc)
-> Doc
forall a.
PrintingInformation
-> (ChunkDB -> UMap a)
-> String
-> String
-> String
-> String
-> (a -> Doc)
-> (a -> Doc)
-> (a -> Doc)
-> Doc
mkTableFromLenses PrintingInformation
pinfo ChunkDB -> UMap QuantityDict
symbolTable
"Symbol Chunks" "UID" "Term" "Symbol"
(String -> Doc
text (String -> Doc) -> (QuantityDict -> String) -> QuantityDict -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. QuantityDict -> String
forall a. HasUID a => a -> String
showUID)
(ChunkDB -> Stage -> Linearity -> Sentence -> Doc
sentenceDoc (PrintingInformation
pinfo PrintingInformation
-> Getting ChunkDB PrintingInformation ChunkDB -> ChunkDB
forall s a. s -> Getting a s a -> a
^. Getting ChunkDB PrintingInformation ChunkDB
Lens' PrintingInformation ChunkDB
ckdb) (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) Linearity
Nonlinear (Sentence -> Doc)
-> (QuantityDict -> Sentence) -> QuantityDict -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NP -> Sentence
forall n. NounPhrase n => n -> Sentence
phraseNP (NP -> Sentence)
-> (QuantityDict -> NP) -> QuantityDict -> Sentence
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Getting NP QuantityDict NP -> QuantityDict -> NP
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting NP QuantityDict NP
forall c. NamedIdea c => Lens' c NP
term)
(Symbol -> Doc
symbolDoc (Symbol -> Doc) -> (QuantityDict -> Symbol) -> QuantityDict -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (QuantityDict -> Stage -> Symbol)
-> Stage -> QuantityDict -> Symbol
forall a b c. (a -> b -> c) -> b -> a -> c
flip QuantityDict -> Stage -> Symbol
forall c. HasSymbol c => c -> Stage -> Symbol
L.symbol (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))
mkTableOfTerms :: PrintingInformation -> Doc
mkTableOfTerms :: PrintingInformation -> Doc
mkTableOfTerms pinfo :: PrintingInformation
pinfo = PrintingInformation
-> (ChunkDB -> UMap IdeaDict)
-> String
-> String
-> String
-> String
-> (IdeaDict -> Doc)
-> (IdeaDict -> Doc)
-> (IdeaDict -> Doc)
-> Doc
forall a.
PrintingInformation
-> (ChunkDB -> UMap a)
-> String
-> String
-> String
-> String
-> (a -> Doc)
-> (a -> Doc)
-> (a -> Doc)
-> Doc
mkTableFromLenses PrintingInformation
pinfo ChunkDB -> UMap IdeaDict
termTable
"Term Chunks" "UID" "Term" "Abbreviation"
(String -> Doc
text (String -> Doc) -> (IdeaDict -> String) -> IdeaDict -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IdeaDict -> String
forall a. HasUID a => a -> String
showUID)
(ChunkDB -> Stage -> Linearity -> Sentence -> Doc
sentenceDoc (PrintingInformation
pinfo PrintingInformation
-> Getting ChunkDB PrintingInformation ChunkDB -> ChunkDB
forall s a. s -> Getting a s a -> a
^. Getting ChunkDB PrintingInformation ChunkDB
Lens' PrintingInformation ChunkDB
ckdb) (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) Linearity
Nonlinear (Sentence -> Doc) -> (IdeaDict -> Sentence) -> IdeaDict -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NP -> Sentence
forall n. NounPhrase n => n -> Sentence
phraseNP (NP -> Sentence) -> (IdeaDict -> NP) -> IdeaDict -> Sentence
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Getting NP IdeaDict NP -> IdeaDict -> NP
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting NP IdeaDict NP
forall c. NamedIdea c => Lens' c NP
term)
(String -> Doc
text (String -> Doc) -> (IdeaDict -> String) -> IdeaDict -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Maybe String -> String
forall a. a -> Maybe a -> a
fromMaybe "" (Maybe String -> String)
-> (IdeaDict -> Maybe String) -> IdeaDict -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IdeaDict -> Maybe String
forall c. Idea c => c -> Maybe String
getA)
mkTableConcepts :: PrintingInformation -> Doc
mkTableConcepts :: PrintingInformation -> Doc
mkTableConcepts pinfo :: PrintingInformation
pinfo = PrintingInformation
-> (ChunkDB -> UMap ConceptChunk)
-> String
-> String
-> String
-> String
-> (ConceptChunk -> Doc)
-> (ConceptChunk -> Doc)
-> (ConceptChunk -> Doc)
-> Doc
forall a.
PrintingInformation
-> (ChunkDB -> UMap a)
-> String
-> String
-> String
-> String
-> (a -> Doc)
-> (a -> Doc)
-> (a -> Doc)
-> Doc
mkTableFromLenses PrintingInformation
pinfo ChunkDB -> UMap ConceptChunk
defTable
"Concepts" "UID" "Term" "Definition"
(String -> Doc
text (String -> Doc) -> (ConceptChunk -> String) -> ConceptChunk -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ConceptChunk -> String
forall a. HasUID a => a -> String
showUID)
(ChunkDB -> Stage -> Linearity -> Sentence -> Doc
sentenceDoc (PrintingInformation
pinfo PrintingInformation
-> Getting ChunkDB PrintingInformation ChunkDB -> ChunkDB
forall s a. s -> Getting a s a -> a
^. Getting ChunkDB PrintingInformation ChunkDB
Lens' PrintingInformation ChunkDB
ckdb) (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) Linearity
Nonlinear (Sentence -> Doc)
-> (ConceptChunk -> Sentence) -> ConceptChunk -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NP -> Sentence
forall n. NounPhrase n => n -> Sentence
phraseNP (NP -> Sentence)
-> (ConceptChunk -> NP) -> ConceptChunk -> Sentence
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Getting NP ConceptChunk NP -> ConceptChunk -> NP
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting NP ConceptChunk NP
forall c. NamedIdea c => Lens' c NP
term)
(ChunkDB -> Stage -> Linearity -> Sentence -> Doc
sentenceDoc (PrintingInformation
pinfo PrintingInformation
-> Getting ChunkDB PrintingInformation ChunkDB -> ChunkDB
forall s a. s -> Getting a s a -> a
^. Getting ChunkDB PrintingInformation ChunkDB
Lens' PrintingInformation ChunkDB
ckdb) (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) Linearity
Linear (Sentence -> Doc)
-> (ConceptChunk -> Sentence) -> ConceptChunk -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Getting Sentence ConceptChunk Sentence -> ConceptChunk -> Sentence
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting Sentence ConceptChunk Sentence
forall c. Definition c => Lens' c Sentence
defn)
mkTableUnitDefn :: PrintingInformation -> Doc
mkTableUnitDefn :: PrintingInformation -> Doc
mkTableUnitDefn pinfo :: PrintingInformation
pinfo = PrintingInformation
-> (ChunkDB -> UMap UnitDefn)
-> String
-> String
-> String
-> String
-> (UnitDefn -> Doc)
-> (UnitDefn -> Doc)
-> (UnitDefn -> Doc)
-> Doc
forall a.
PrintingInformation
-> (ChunkDB -> UMap a)
-> String
-> String
-> String
-> String
-> (a -> Doc)
-> (a -> Doc)
-> (a -> Doc)
-> Doc
mkTableFromLenses PrintingInformation
pinfo (Getting (UMap UnitDefn) ChunkDB (UMap UnitDefn)
-> ChunkDB -> UMap UnitDefn
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting (UMap UnitDefn) ChunkDB (UMap UnitDefn)
Lens' ChunkDB (UMap UnitDefn)
unitTable)
"Unit Definitions" "UID" "Term" "Unit Symbol"
(String -> Doc
text (String -> Doc) -> (UnitDefn -> String) -> UnitDefn -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. UnitDefn -> String
forall a. HasUID a => a -> String
showUID)
(ChunkDB -> Stage -> Linearity -> Sentence -> Doc
sentenceDoc (PrintingInformation
pinfo PrintingInformation
-> Getting ChunkDB PrintingInformation ChunkDB -> ChunkDB
forall s a. s -> Getting a s a -> a
^. Getting ChunkDB PrintingInformation ChunkDB
Lens' PrintingInformation ChunkDB
ckdb) (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) Linearity
Nonlinear (Sentence -> Doc) -> (UnitDefn -> Sentence) -> UnitDefn -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NP -> Sentence
forall n. NounPhrase n => n -> Sentence
phraseNP (NP -> Sentence) -> (UnitDefn -> NP) -> UnitDefn -> Sentence
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Getting NP UnitDefn NP -> UnitDefn -> NP
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting NP UnitDefn NP
forall c. NamedIdea c => Lens' c NP
term)
(ChunkDB -> Stage -> Linearity -> Sentence -> Doc
sentenceDoc (PrintingInformation
pinfo PrintingInformation
-> Getting ChunkDB PrintingInformation ChunkDB -> ChunkDB
forall s a. s -> Getting a s a -> a
^. Getting ChunkDB PrintingInformation ChunkDB
Lens' PrintingInformation ChunkDB
ckdb) (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) Linearity
Linear (Sentence -> Doc) -> (UnitDefn -> Sentence) -> UnitDefn -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. USymb -> Sentence
Sy (USymb -> Sentence) -> (UnitDefn -> USymb) -> UnitDefn -> Sentence
forall b c a. (b -> c) -> (a -> b) -> a -> c
. UnitDefn -> USymb
forall u. HasUnitSymbol u => u -> USymb
usymb)
mkTableDataDef :: PrintingInformation -> Doc
mkTableDataDef :: PrintingInformation -> Doc
mkTableDataDef pinfo :: PrintingInformation
pinfo = PrintingInformation
-> (ChunkDB -> UMap DataDefinition)
-> String
-> String
-> String
-> String
-> (DataDefinition -> Doc)
-> (DataDefinition -> Doc)
-> (DataDefinition -> Doc)
-> Doc
forall a.
PrintingInformation
-> (ChunkDB -> UMap a)
-> String
-> String
-> String
-> String
-> (a -> Doc)
-> (a -> Doc)
-> (a -> Doc)
-> Doc
mkTableFromLenses PrintingInformation
pinfo (Getting (UMap DataDefinition) ChunkDB (UMap DataDefinition)
-> ChunkDB -> UMap DataDefinition
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting (UMap DataDefinition) ChunkDB (UMap DataDefinition)
Lens' ChunkDB (UMap DataDefinition)
dataDefnTable)
"Data Definitions" "UID" "Term" "Symbol"
(String -> Doc
text (String -> Doc)
-> (DataDefinition -> String) -> DataDefinition -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DataDefinition -> String
forall a. HasUID a => a -> String
showUID)
(ChunkDB -> Stage -> Linearity -> Sentence -> Doc
sentenceDoc (PrintingInformation
pinfo PrintingInformation
-> Getting ChunkDB PrintingInformation ChunkDB -> ChunkDB
forall s a. s -> Getting a s a -> a
^. Getting ChunkDB PrintingInformation ChunkDB
Lens' PrintingInformation ChunkDB
ckdb) (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) Linearity
Nonlinear (Sentence -> Doc)
-> (DataDefinition -> Sentence) -> DataDefinition -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NP -> Sentence
forall n. NounPhrase n => n -> Sentence
phraseNP (NP -> Sentence)
-> (DataDefinition -> NP) -> DataDefinition -> Sentence
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Getting NP DataDefinition NP -> DataDefinition -> NP
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting NP DataDefinition NP
forall c. NamedIdea c => Lens' c NP
term)
(Symbol -> Doc
symbolDoc (Symbol -> Doc)
-> (DataDefinition -> Symbol) -> DataDefinition -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (DataDefinition -> Stage -> Symbol)
-> Stage -> DataDefinition -> Symbol
forall a b c. (a -> b -> c) -> b -> a -> c
flip DataDefinition -> Stage -> Symbol
forall c. HasSymbol c => c -> Stage -> Symbol
L.symbol (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))
mkTableGenDef :: PrintingInformation -> Doc
mkTableGenDef :: PrintingInformation -> Doc
mkTableGenDef pinfo :: PrintingInformation
pinfo = PrintingInformation
-> (ChunkDB -> UMap GenDefn)
-> String
-> String
-> String
-> String
-> (GenDefn -> Doc)
-> (GenDefn -> Doc)
-> (GenDefn -> Doc)
-> Doc
forall a.
PrintingInformation
-> (ChunkDB -> UMap a)
-> String
-> String
-> String
-> String
-> (a -> Doc)
-> (a -> Doc)
-> (a -> Doc)
-> Doc
mkTableFromLenses PrintingInformation
pinfo (Getting (UMap GenDefn) ChunkDB (UMap GenDefn)
-> ChunkDB -> UMap GenDefn
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting (UMap GenDefn) ChunkDB (UMap GenDefn)
Lens' ChunkDB (UMap GenDefn)
gendefTable)
"General Definitions" "UID" "Term" "Definition"
(String -> Doc
text (String -> Doc) -> (GenDefn -> String) -> GenDefn -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GenDefn -> String
forall a. HasUID a => a -> String
showUID)
(ChunkDB -> Stage -> Linearity -> Sentence -> Doc
sentenceDoc (PrintingInformation
pinfo PrintingInformation
-> Getting ChunkDB PrintingInformation ChunkDB -> ChunkDB
forall s a. s -> Getting a s a -> a
^. Getting ChunkDB PrintingInformation ChunkDB
Lens' PrintingInformation ChunkDB
ckdb) (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) Linearity
Nonlinear (Sentence -> Doc) -> (GenDefn -> Sentence) -> GenDefn -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NP -> Sentence
forall n. NounPhrase n => n -> Sentence
phraseNP (NP -> Sentence) -> (GenDefn -> NP) -> GenDefn -> Sentence
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Getting NP GenDefn NP -> GenDefn -> NP
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting NP GenDefn NP
forall c. NamedIdea c => Lens' c NP
term)
(ChunkDB -> Stage -> Linearity -> Sentence -> Doc
sentenceDoc (PrintingInformation
pinfo PrintingInformation
-> Getting ChunkDB PrintingInformation ChunkDB -> ChunkDB
forall s a. s -> Getting a s a -> a
^. Getting ChunkDB PrintingInformation ChunkDB
Lens' PrintingInformation ChunkDB
ckdb) (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) Linearity
Linear (Sentence -> Doc) -> (GenDefn -> Sentence) -> GenDefn -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Getting Sentence GenDefn Sentence -> GenDefn -> Sentence
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting Sentence GenDefn Sentence
forall c. Definition c => Lens' c Sentence
defn)
mkTableTMod :: PrintingInformation -> Doc
mkTableTMod :: PrintingInformation -> Doc
mkTableTMod pinfo :: PrintingInformation
pinfo = PrintingInformation
-> (ChunkDB -> UMap TheoryModel)
-> String
-> String
-> String
-> String
-> (TheoryModel -> Doc)
-> (TheoryModel -> Doc)
-> (TheoryModel -> Doc)
-> Doc
forall a.
PrintingInformation
-> (ChunkDB -> UMap a)
-> String
-> String
-> String
-> String
-> (a -> Doc)
-> (a -> Doc)
-> (a -> Doc)
-> Doc
mkTableFromLenses PrintingInformation
pinfo (Getting (UMap TheoryModel) ChunkDB (UMap TheoryModel)
-> ChunkDB -> UMap TheoryModel
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting (UMap TheoryModel) ChunkDB (UMap TheoryModel)
Lens' ChunkDB (UMap TheoryModel)
theoryModelTable)
"Theory Models" "UID" "Term" "Definition"
(String -> Doc
text (String -> Doc) -> (TheoryModel -> String) -> TheoryModel -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TheoryModel -> String
forall a. HasUID a => a -> String
showUID)
(ChunkDB -> Stage -> Linearity -> Sentence -> Doc
sentenceDoc (PrintingInformation
pinfo PrintingInformation
-> Getting ChunkDB PrintingInformation ChunkDB -> ChunkDB
forall s a. s -> Getting a s a -> a
^. Getting ChunkDB PrintingInformation ChunkDB
Lens' PrintingInformation ChunkDB
ckdb) (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) Linearity
Nonlinear (Sentence -> Doc)
-> (TheoryModel -> Sentence) -> TheoryModel -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NP -> Sentence
forall n. NounPhrase n => n -> Sentence
phraseNP (NP -> Sentence) -> (TheoryModel -> NP) -> TheoryModel -> Sentence
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Getting NP TheoryModel NP -> TheoryModel -> NP
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting NP TheoryModel NP
forall c. NamedIdea c => Lens' c NP
term)
(ChunkDB -> Stage -> Linearity -> Sentence -> Doc
sentenceDoc (PrintingInformation
pinfo PrintingInformation
-> Getting ChunkDB PrintingInformation ChunkDB -> ChunkDB
forall s a. s -> Getting a s a -> a
^. Getting ChunkDB PrintingInformation ChunkDB
Lens' PrintingInformation ChunkDB
ckdb) (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) Linearity
Linear (Sentence -> Doc)
-> (TheoryModel -> Sentence) -> TheoryModel -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Getting Sentence TheoryModel Sentence -> TheoryModel -> Sentence
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting Sentence TheoryModel Sentence
forall c. Definition c => Lens' c Sentence
defn)
mkTableIMod :: PrintingInformation -> Doc
mkTableIMod :: PrintingInformation -> Doc
mkTableIMod pinfo :: PrintingInformation
pinfo = PrintingInformation
-> (ChunkDB -> UMap InstanceModel)
-> String
-> String
-> String
-> String
-> (InstanceModel -> Doc)
-> (InstanceModel -> Doc)
-> (InstanceModel -> Doc)
-> Doc
forall a.
PrintingInformation
-> (ChunkDB -> UMap a)
-> String
-> String
-> String
-> String
-> (a -> Doc)
-> (a -> Doc)
-> (a -> Doc)
-> Doc
mkTableFromLenses PrintingInformation
pinfo (Getting (UMap InstanceModel) ChunkDB (UMap InstanceModel)
-> ChunkDB -> UMap InstanceModel
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting (UMap InstanceModel) ChunkDB (UMap InstanceModel)
Lens' ChunkDB (UMap InstanceModel)
insmodelTable)
"Instance Models" "UID" "Term" "Definition"
(String -> Doc
text (String -> Doc)
-> (InstanceModel -> String) -> InstanceModel -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. InstanceModel -> String
forall a. HasUID a => a -> String
showUID)
(ChunkDB -> Stage -> Linearity -> Sentence -> Doc
sentenceDoc (PrintingInformation
pinfo PrintingInformation
-> Getting ChunkDB PrintingInformation ChunkDB -> ChunkDB
forall s a. s -> Getting a s a -> a
^. Getting ChunkDB PrintingInformation ChunkDB
Lens' PrintingInformation ChunkDB
ckdb) (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) Linearity
Nonlinear (Sentence -> Doc)
-> (InstanceModel -> Sentence) -> InstanceModel -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NP -> Sentence
forall n. NounPhrase n => n -> Sentence
phraseNP (NP -> Sentence)
-> (InstanceModel -> NP) -> InstanceModel -> Sentence
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Getting NP InstanceModel NP -> InstanceModel -> NP
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting NP InstanceModel NP
forall c. NamedIdea c => Lens' c NP
term)
(ChunkDB -> Stage -> Linearity -> Sentence -> Doc
sentenceDoc (PrintingInformation
pinfo PrintingInformation
-> Getting ChunkDB PrintingInformation ChunkDB -> ChunkDB
forall s a. s -> Getting a s a -> a
^. Getting ChunkDB PrintingInformation ChunkDB
Lens' PrintingInformation ChunkDB
ckdb) (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) Linearity
Linear (Sentence -> Doc)
-> (InstanceModel -> Sentence) -> InstanceModel -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Getting Sentence InstanceModel Sentence
-> InstanceModel -> Sentence
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting Sentence InstanceModel Sentence
forall c. Definition c => Lens' c Sentence
defn)
mkTableCI :: PrintingInformation -> Doc
mkTableCI :: PrintingInformation -> Doc
mkTableCI pinfo :: PrintingInformation
pinfo = PrintingInformation
-> (ChunkDB -> UMap ConceptInstance)
-> String
-> String
-> String
-> String
-> (ConceptInstance -> Doc)
-> (ConceptInstance -> Doc)
-> (ConceptInstance -> Doc)
-> Doc
forall a.
PrintingInformation
-> (ChunkDB -> UMap a)
-> String
-> String
-> String
-> String
-> (a -> Doc)
-> (a -> Doc)
-> (a -> Doc)
-> Doc
mkTableFromLenses PrintingInformation
pinfo (Getting (UMap ConceptInstance) ChunkDB (UMap ConceptInstance)
-> ChunkDB -> UMap ConceptInstance
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting (UMap ConceptInstance) ChunkDB (UMap ConceptInstance)
Lens' ChunkDB (UMap ConceptInstance)
conceptinsTable)
"ConceptInstance" "UID" "Term" "ShortName"
(String -> Doc
text (String -> Doc)
-> (ConceptInstance -> String) -> ConceptInstance -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ConceptInstance -> String
forall a. HasUID a => a -> String
showUID)
(ChunkDB -> Stage -> Linearity -> Sentence -> Doc
sentenceDoc (PrintingInformation
pinfo PrintingInformation
-> Getting ChunkDB PrintingInformation ChunkDB -> ChunkDB
forall s a. s -> Getting a s a -> a
^. Getting ChunkDB PrintingInformation ChunkDB
Lens' PrintingInformation ChunkDB
ckdb) (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) Linearity
Nonlinear (Sentence -> Doc)
-> (ConceptInstance -> Sentence) -> ConceptInstance -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NP -> Sentence
forall n. NounPhrase n => n -> Sentence
phraseNP (NP -> Sentence)
-> (ConceptInstance -> NP) -> ConceptInstance -> Sentence
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Getting NP ConceptInstance NP -> ConceptInstance -> NP
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting NP ConceptInstance NP
forall c. NamedIdea c => Lens' c NP
term)
(ChunkDB -> Stage -> Linearity -> Sentence -> Doc
sentenceDoc (PrintingInformation
pinfo PrintingInformation
-> Getting ChunkDB PrintingInformation ChunkDB -> ChunkDB
forall s a. s -> Getting a s a -> a
^. Getting ChunkDB PrintingInformation ChunkDB
Lens' PrintingInformation ChunkDB
ckdb) (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) Linearity
Linear (Sentence -> Doc)
-> (ConceptInstance -> Sentence) -> ConceptInstance -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ShortName -> Sentence
getSentSN (ShortName -> Sentence)
-> (ConceptInstance -> ShortName) -> ConceptInstance -> Sentence
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ConceptInstance -> ShortName
forall s. HasShortName s => s -> ShortName
shortname)
mkTableSec :: PrintingInformation -> Doc
mkTableSec :: PrintingInformation -> Doc
mkTableSec pinfo :: PrintingInformation
pinfo = PrintingInformation
-> (ChunkDB -> UMap Section)
-> String
-> String
-> String
-> String
-> (Section -> Doc)
-> (Section -> Doc)
-> (Section -> Doc)
-> Doc
forall a.
PrintingInformation
-> (ChunkDB -> UMap a)
-> String
-> String
-> String
-> String
-> (a -> Doc)
-> (a -> Doc)
-> (a -> Doc)
-> Doc
mkTableFromLenses PrintingInformation
pinfo (Getting (UMap Section) ChunkDB (UMap Section)
-> ChunkDB -> UMap Section
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting (UMap Section) ChunkDB (UMap Section)
Lens' ChunkDB (UMap Section)
sectionTable)
"Sections" "UID" "Title" "ShortName"
(String -> Doc
text (String -> Doc) -> (Section -> String) -> Section -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Section -> String
forall a. HasUID a => a -> String
showUID)
(ChunkDB -> Stage -> Linearity -> Sentence -> Doc
sentenceDoc (PrintingInformation
pinfo PrintingInformation
-> Getting ChunkDB PrintingInformation ChunkDB -> ChunkDB
forall s a. s -> Getting a s a -> a
^. Getting ChunkDB PrintingInformation ChunkDB
Lens' PrintingInformation ChunkDB
ckdb) (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) Linearity
Nonlinear (Sentence -> Doc) -> (Section -> Sentence) -> Section -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Section -> Sentence
tle)
(ChunkDB -> Stage -> Linearity -> Sentence -> Doc
sentenceDoc (PrintingInformation
pinfo PrintingInformation
-> Getting ChunkDB PrintingInformation ChunkDB -> ChunkDB
forall s a. s -> Getting a s a -> a
^. Getting ChunkDB PrintingInformation ChunkDB
Lens' PrintingInformation ChunkDB
ckdb) (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) Linearity
Linear (Sentence -> Doc) -> (Section -> Sentence) -> Section -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ShortName -> Sentence
getSentSN (ShortName -> Sentence)
-> (Section -> ShortName) -> Section -> Sentence
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Section -> ShortName
forall s. HasShortName s => s -> ShortName
shortname)
mkTableLC :: PrintingInformation -> Doc
mkTableLC :: PrintingInformation -> Doc
mkTableLC pinfo :: PrintingInformation
pinfo = PrintingInformation
-> (ChunkDB -> UMap LabelledContent)
-> String
-> String
-> String
-> String
-> (LabelledContent -> Doc)
-> (LabelledContent -> Doc)
-> (LabelledContent -> Doc)
-> Doc
forall a.
PrintingInformation
-> (ChunkDB -> UMap a)
-> String
-> String
-> String
-> String
-> (a -> Doc)
-> (a -> Doc)
-> (a -> Doc)
-> Doc
mkTableFromLenses PrintingInformation
pinfo (Getting (UMap LabelledContent) ChunkDB (UMap LabelledContent)
-> ChunkDB -> UMap LabelledContent
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting (UMap LabelledContent) ChunkDB (UMap LabelledContent)
Lens' ChunkDB (UMap LabelledContent)
labelledcontentTable)
"LabelledContent" "UID" "ShortName" "Type of Content"
(String -> Doc
text (String -> Doc)
-> (LabelledContent -> String) -> LabelledContent -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LabelledContent -> String
forall a. HasUID a => a -> String
showUID)
(ChunkDB -> Stage -> Linearity -> Sentence -> Doc
sentenceDoc (PrintingInformation
pinfo PrintingInformation
-> Getting ChunkDB PrintingInformation ChunkDB -> ChunkDB
forall s a. s -> Getting a s a -> a
^. Getting ChunkDB PrintingInformation ChunkDB
Lens' PrintingInformation ChunkDB
ckdb) (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) Linearity
Linear (Sentence -> Doc)
-> (LabelledContent -> Sentence) -> LabelledContent -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ShortName -> Sentence
getSentSN (ShortName -> Sentence)
-> (LabelledContent -> ShortName) -> LabelledContent -> Sentence
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LabelledContent -> ShortName
forall s. HasShortName s => s -> ShortName
shortname)
(String -> Doc
text (String -> Doc)
-> (LabelledContent -> String) -> LabelledContent -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. RawContent -> String
getContConst (RawContent -> String)
-> (LabelledContent -> RawContent) -> LabelledContent -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Getting RawContent LabelledContent RawContent
-> LabelledContent -> RawContent
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting RawContent LabelledContent RawContent
forall c. HasContents c => Lens' c RawContent
accessContents)
where
getContConst :: RawContent -> String
getContConst :: RawContent -> String
getContConst Table{} = "Table"
getContConst Paragraph{} = "Paragraph"
getContConst EqnBlock{} = "Equation"
getContConst DerivBlock{} = "Derivation"
getContConst Enumeration{} = "Enumeration"
getContConst Defini{} = "Definition or Model"
getContConst Figure{} = "Figure"
getContConst Bib{} = "Bibliography"
getContConst Graph{} = "Graph"
mkTableRef :: PrintingInformation -> Doc
mkTableRef :: PrintingInformation -> Doc
mkTableRef pinfo :: PrintingInformation
pinfo = PrintingInformation
-> (ChunkDB -> UMap Reference)
-> String
-> String
-> String
-> String
-> (Reference -> Doc)
-> (Reference -> Doc)
-> (Reference -> Doc)
-> Doc
forall a.
PrintingInformation
-> (ChunkDB -> UMap a)
-> String
-> String
-> String
-> String
-> (a -> Doc)
-> (a -> Doc)
-> (a -> Doc)
-> Doc
mkTableFromLenses PrintingInformation
pinfo (Getting (UMap Reference) ChunkDB (UMap Reference)
-> ChunkDB -> UMap Reference
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting (UMap Reference) ChunkDB (UMap Reference)
Lens' ChunkDB (UMap Reference)
refTable)
"Reference" "UID" "Reference Address" "ShortName"
(String -> Doc
text (String -> Doc) -> (Reference -> String) -> Reference -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Reference -> String
forall a. HasUID a => a -> String
showUID)
(String -> Doc
text (String -> Doc) -> (Reference -> String) -> Reference -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LblType -> String
getAdd (LblType -> String)
-> (Reference -> LblType) -> Reference -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Reference -> LblType
forall b. HasRefAddress b => b -> LblType
getRefAdd)
(ChunkDB -> Stage -> Linearity -> Sentence -> Doc
sentenceDoc (PrintingInformation
pinfo PrintingInformation
-> Getting ChunkDB PrintingInformation ChunkDB -> ChunkDB
forall s a. s -> Getting a s a -> a
^. Getting ChunkDB PrintingInformation ChunkDB
Lens' PrintingInformation ChunkDB
ckdb) (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) Linearity
Linear (Sentence -> Doc) -> (Reference -> Sentence) -> Reference -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ShortName -> Sentence
getSentSN (ShortName -> Sentence)
-> (Reference -> ShortName) -> Reference -> Sentence
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Reference -> ShortName
forall s. HasShortName s => s -> ShortName
shortname)
mkTableDepChunks :: PrintingInformation -> Doc
mkTableDepChunks :: PrintingInformation -> Doc
mkTableDepChunks PI{_ckdb :: PrintingInformation -> ChunkDB
_ckdb = ChunkDB
db} = String -> Doc
text "Dependent Chunks (the chunks on the left use the chunks on the right in some capacity)" Doc -> Doc -> Doc
<> Doc
colon
Doc -> Doc -> Doc
$$ Doc -> Doc
header (String -> Doc
text "UID" Doc -> Doc -> Doc
$$ Int -> Doc -> Doc
nest Int
nestNum (String -> Doc
text "Dependent UIDs"))
Doc -> Doc -> Doc
$$ [Doc] -> Doc
vcat (((UID, [UID]) -> Doc) -> [(UID, [UID])] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (UID, [UID]) -> Doc
testIndepLayout [(UID, [UID])]
traceMapUIDs)
where
testIndepLayout :: (UID, [UID]) -> Doc
testIndepLayout :: (UID, [UID]) -> Doc
testIndepLayout (x :: UID
x, ys :: [UID]
ys) = String -> Doc
text (UID -> String
forall a. Show a => a -> String
show UID
x) Doc -> Doc -> Doc
$$ Int -> Doc -> Doc
nest Int
nestNum (String -> Doc
text (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ [UID] -> String
forall a. Show a => a -> String
show [UID]
ys)
traceMapUIDs :: [(UID, [UID])]
traceMapUIDs :: [(UID, [UID])]
traceMapUIDs = Map UID [UID] -> [(UID, [UID])]
forall k a. Map k a -> [(k, a)]
Map.assocs (Map UID [UID] -> [(UID, [UID])])
-> Map UID [UID] -> [(UID, [UID])]
forall a b. (a -> b) -> a -> b
$ ChunkDB
db ChunkDB
-> Getting (Map UID [UID]) ChunkDB (Map UID [UID]) -> Map UID [UID]
forall s a. s -> Getting a s a -> a
^. Getting (Map UID [UID]) ChunkDB (Map UID [UID])
Lens' ChunkDB (Map UID [UID])
traceTable
nestNum :: Int
nestNum = 30
mkTableReferencedChunks :: PrintingInformation -> Doc
mkTableReferencedChunks :: PrintingInformation -> Doc
mkTableReferencedChunks PI{_ckdb :: PrintingInformation -> ChunkDB
_ckdb = ChunkDB
db} = String -> Doc
text "Referenced Chunks (other chunks build from these)" Doc -> Doc -> Doc
<> Doc
colon
Doc -> Doc -> Doc
$$ Doc -> Doc
header (String -> Doc
text "UID" Doc -> Doc -> Doc
$$ Int -> Doc -> Doc
nest Int
nestNum (String -> Doc
text "UIDs that use the left UID"))
Doc -> Doc -> Doc
$$ [Doc] -> Doc
vcat (((UID, [UID]) -> Doc) -> [(UID, [UID])] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (UID, [UID]) -> Doc
testIsolateLayout [(UID, [UID])]
refbyUIDs)
where
testIsolateLayout :: (UID, [UID]) -> Doc
testIsolateLayout :: (UID, [UID]) -> Doc
testIsolateLayout (x :: UID
x, ys :: [UID]
ys) = String -> Doc
text (UID -> String
forall a. Show a => a -> String
show UID
x) Doc -> Doc -> Doc
$$ Int -> Doc -> Doc
nest Int
nestNum (String -> Doc
text (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ [UID] -> String
forall a. Show a => a -> String
show [UID]
ys)
refbyUIDs :: [(UID, [UID])]
refbyUIDs :: [(UID, [UID])]
refbyUIDs = Map UID [UID] -> [(UID, [UID])]
forall k a. Map k a -> [(k, a)]
Map.assocs (Map UID [UID] -> [(UID, [UID])])
-> Map UID [UID] -> [(UID, [UID])]
forall a b. (a -> b) -> a -> b
$ ChunkDB
db ChunkDB
-> Getting (Map UID [UID]) ChunkDB (Map UID [UID]) -> Map UID [UID]
forall s a. s -> Getting a s a -> a
^. Getting (Map UID [UID]) ChunkDB (Map UID [UID])
Lens' ChunkDB (Map UID [UID])
refbyTable
nestNum :: Int
nestNum = 30
mkTableDepReffedChunks :: PrintingInformation -> Doc
mkTableDepReffedChunks :: PrintingInformation -> Doc
mkTableDepReffedChunks PI{_ckdb :: PrintingInformation -> ChunkDB
_ckdb = ChunkDB
db} = String -> Doc
text "Dependent and Referenced Chunks (chunks dependent on middle UIDs and used in the chunks on the right)" Doc -> Doc -> Doc
<> Doc
colon
Doc -> Doc -> Doc
$$ Doc -> Doc
header (String -> Doc
text "UID" Doc -> Doc -> Doc
$$ Int -> Doc -> Doc
nest Int
nestNum (String -> Doc
text "Dependent Chunk") Doc -> Doc -> Doc
$$ Int -> Doc -> Doc
nest (Int
nestNumInt -> Int -> Int
forall a. Num a => a -> a -> a
*3) (String -> Doc
text "Used-in Chunk"))
Doc -> Doc -> Doc
$$ [Doc] -> Doc
vcat (((UID, ([UID], [UID])) -> Doc) -> [(UID, ([UID], [UID]))] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (UID, ([UID], [UID])) -> Doc
traceRefLayout ([(UID, ([UID], [UID]))] -> [Doc])
-> [(UID, ([UID], [UID]))] -> [Doc]
forall a b. (a -> b) -> a -> b
$ Map UID ([UID], [UID]) -> [(UID, ([UID], [UID]))]
forall k a. Map k a -> [(k, a)]
Map.assocs Map UID ([UID], [UID])
combinedMaps)
where
traceRefLayout :: (UID, ([UID], [UID])) -> Doc
traceRefLayout :: (UID, ([UID], [UID])) -> Doc
traceRefLayout x :: (UID, ([UID], [UID]))
x = String -> Doc
text (UID -> String
forall a. Show a => a -> String
show (UID -> String) -> UID -> String
forall a b. (a -> b) -> a -> b
$ (UID, ([UID], [UID])) -> UID
forall a b. (a, b) -> a
fst (UID, ([UID], [UID]))
x) Doc -> Doc -> Doc
$$ Int -> Doc -> Doc
nest Int
nestNum (String -> Doc
text (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ [UID] -> String
forall a. Show a => a -> String
show ([UID] -> String) -> [UID] -> String
forall a b. (a -> b) -> a -> b
$ ([UID], [UID]) -> [UID]
forall a b. (a, b) -> a
fst (([UID], [UID]) -> [UID]) -> ([UID], [UID]) -> [UID]
forall a b. (a -> b) -> a -> b
$ (UID, ([UID], [UID])) -> ([UID], [UID])
forall a b. (a, b) -> b
snd (UID, ([UID], [UID]))
x)
Doc -> Doc -> Doc
$$ Int -> Doc -> Doc
nest (Int
nestNumInt -> Int -> Int
forall a. Num a => a -> a -> a
*3) (String -> Doc
text (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ [UID] -> String
forall a. Show a => a -> String
show ([UID] -> String) -> [UID] -> String
forall a b. (a -> b) -> a -> b
$ ([UID], [UID]) -> [UID]
forall a b. (a, b) -> b
snd (([UID], [UID]) -> [UID]) -> ([UID], [UID]) -> [UID]
forall a b. (a -> b) -> a -> b
$ (UID, ([UID], [UID])) -> ([UID], [UID])
forall a b. (a, b) -> b
snd (UID, ([UID], [UID]))
x)
combinedMaps :: Map UID ([UID], [UID])
combinedMaps = (([UID], [UID]) -> ([UID], [UID]) -> ([UID], [UID]))
-> Map UID ([UID], [UID])
-> Map UID ([UID], [UID])
-> Map UID ([UID], [UID])
forall k a. Ord k => (a -> a -> a) -> Map k a -> Map k a -> Map k a
Map.unionWith (\x :: ([UID], [UID])
x y :: ([UID], [UID])
y -> (([UID], [UID]) -> [UID]
forall a b. (a, b) -> a
fst ([UID], [UID])
x, ([UID], [UID]) -> [UID]
forall a b. (a, b) -> b
snd ([UID], [UID])
y)) Map UID ([UID], [UID])
forall a. Map UID ([UID], [a])
traceMapUIDs Map UID ([UID], [UID])
forall a. Map UID ([a], [UID])
refByUIDs
traceMapUIDs :: Map UID ([UID], [a])
traceMapUIDs = [(UID, ([UID], [a]))] -> Map UID ([UID], [a])
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList ([(UID, ([UID], [a]))] -> Map UID ([UID], [a]))
-> [(UID, ([UID], [a]))] -> Map UID ([UID], [a])
forall a b. (a -> b) -> a -> b
$ ((UID, [UID]) -> (UID, ([UID], [a])))
-> [(UID, [UID])] -> [(UID, ([UID], [a]))]
forall a b. (a -> b) -> [a] -> [b]
map (\(x :: UID
x, y :: [UID]
y) -> (UID
x, ([UID]
y, []))) ([(UID, [UID])] -> [(UID, ([UID], [a]))])
-> [(UID, [UID])] -> [(UID, ([UID], [a]))]
forall a b. (a -> b) -> a -> b
$ Map UID [UID] -> [(UID, [UID])]
forall k a. Map k a -> [(k, a)]
Map.assocs (Map UID [UID] -> [(UID, [UID])])
-> Map UID [UID] -> [(UID, [UID])]
forall a b. (a -> b) -> a -> b
$ ChunkDB
db ChunkDB
-> Getting (Map UID [UID]) ChunkDB (Map UID [UID]) -> Map UID [UID]
forall s a. s -> Getting a s a -> a
^. Getting (Map UID [UID]) ChunkDB (Map UID [UID])
Lens' ChunkDB (Map UID [UID])
traceTable
refByUIDs :: Map UID ([a], [UID])
refByUIDs = [(UID, ([a], [UID]))] -> Map UID ([a], [UID])
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList ([(UID, ([a], [UID]))] -> Map UID ([a], [UID]))
-> [(UID, ([a], [UID]))] -> Map UID ([a], [UID])
forall a b. (a -> b) -> a -> b
$ ((UID, [UID]) -> (UID, ([a], [UID])))
-> [(UID, [UID])] -> [(UID, ([a], [UID]))]
forall a b. (a -> b) -> [a] -> [b]
map (\(x :: UID
x, y :: [UID]
y) -> (UID
x, ([], [UID]
y))) ([(UID, [UID])] -> [(UID, ([a], [UID]))])
-> [(UID, [UID])] -> [(UID, ([a], [UID]))]
forall a b. (a -> b) -> a -> b
$ Map UID [UID] -> [(UID, [UID])]
forall k a. Map k a -> [(k, a)]
Map.assocs (Map UID [UID] -> [(UID, [UID])])
-> Map UID [UID] -> [(UID, [UID])]
forall a b. (a -> b) -> a -> b
$ ChunkDB
db ChunkDB
-> Getting (Map UID [UID]) ChunkDB (Map UID [UID]) -> Map UID [UID]
forall s a. s -> Getting a s a -> a
^. Getting (Map UID [UID]) ChunkDB (Map UID [UID])
Lens' ChunkDB (Map UID [UID])
refbyTable
nestNum :: Int
nestNum = 30
renderUsedUIDs :: [(UID, String)] -> Doc
renderUsedUIDs :: [(UID, String)] -> Doc
renderUsedUIDs chs :: [(UID, String)]
chs = Doc -> Doc
header (String -> Doc
text "UIDs" Doc -> Doc -> Doc
$$ Int -> Doc -> Doc
nest 40 (String -> Doc
text "Associated Chunks")) Doc -> Doc -> Doc
$$ [Doc] -> Doc
vcat (((UID, String) -> Doc) -> [(UID, String)] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (UID, String) -> Doc
forall a. Show a => (a, String) -> Doc
renderUsedUID [(UID, String)]
chs)
where
renderUsedUID :: (a, String) -> Doc
renderUsedUID (u :: a
u, chks :: String
chks) = String -> Doc
text (a -> String
forall a. Show a => a -> String
show a
u) Doc -> Doc -> Doc
$$ Int -> Doc -> Doc
nest 40 (String -> Doc
text String
chks)
mkListShowUsedUIDs :: PrintingInformation -> [(UID, String)]
mkListShowUsedUIDs :: PrintingInformation -> [(UID, String)]
mkListShowUsedUIDs PI{_ckdb :: PrintingInformation -> ChunkDB
_ckdb = ChunkDB
db} = ((UID, String) -> (UID, String) -> Ordering)
-> [(UID, String)] -> [(UID, String)]
forall a. (a -> a -> Ordering) -> [a] -> [a]
sortBy (UID -> UID -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (UID -> UID -> Ordering)
-> ((UID, String) -> UID)
-> (UID, String)
-> (UID, String)
-> Ordering
forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
`on` (UID, String) -> UID
forall a b. (a, b) -> a
fst) ([(UID, String)] -> [(UID, String)])
-> [(UID, String)] -> [(UID, String)]
forall a b. (a -> b) -> a -> b
$ ((UID, [String]) -> (UID, String))
-> [(UID, [String])] -> [(UID, String)]
forall a b. (a -> b) -> [a] -> [b]
map (([String] -> String) -> (UID, [String]) -> (UID, String)
forall (p :: * -> * -> *) b c a.
Bifunctor p =>
(b -> c) -> p a b -> p a c
second [String] -> String
stringList) ([(UID, [String])] -> [(UID, String)])
-> [(UID, [String])] -> [(UID, String)]
forall a b. (a -> b) -> a -> b
$ Map UID [String] -> [(UID, [String])]
forall k a. Map k a -> [(k, a)]
Map.toList (Map UID [String] -> [(UID, [String])])
-> Map UID [String] -> [(UID, [String])]
forall a b. (a -> b) -> a -> b
$ ([String] -> [String] -> [String])
-> [(UID, [String])] -> Map UID [String]
forall k a. Ord k => (a -> a -> a) -> [(k, a)] -> Map k a
Map.fromListWith [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
(++) ([(UID, [String])] -> Map UID [String])
-> [(UID, [String])] -> Map UID [String]
forall a b. (a -> b) -> a -> b
$
((UID, (QuantityDict, Int)) -> (UID, [String]))
-> [(UID, (QuantityDict, Int))] -> [(UID, [String])]
forall a b. (a -> b) -> [a] -> [b]
map (\x :: (UID, (QuantityDict, Int))
x -> ((UID, (QuantityDict, Int)) -> UID
forall a b. (a, b) -> a
fst (UID, (QuantityDict, Int))
x, ["QuantityDict"])) (UMap QuantityDict -> [(UID, (QuantityDict, Int))]
forall k a. Map k a -> [(k, a)]
Map.assocs (UMap QuantityDict -> [(UID, (QuantityDict, Int))])
-> UMap QuantityDict -> [(UID, (QuantityDict, Int))]
forall a b. (a -> b) -> a -> b
$ ChunkDB -> UMap QuantityDict
symbolTable ChunkDB
db) [(UID, [String])] -> [(UID, [String])] -> [(UID, [String])]
forall a. [a] -> [a] -> [a]
++
((UID, (IdeaDict, Int)) -> (UID, [String]))
-> [(UID, (IdeaDict, Int))] -> [(UID, [String])]
forall a b. (a -> b) -> [a] -> [b]
map (\x :: (UID, (IdeaDict, Int))
x -> ((UID, (IdeaDict, Int)) -> UID
forall a b. (a, b) -> a
fst (UID, (IdeaDict, Int))
x, ["IdeaDict"])) (UMap IdeaDict -> [(UID, (IdeaDict, Int))]
forall k a. Map k a -> [(k, a)]
Map.assocs (UMap IdeaDict -> [(UID, (IdeaDict, Int))])
-> UMap IdeaDict -> [(UID, (IdeaDict, Int))]
forall a b. (a -> b) -> a -> b
$ ChunkDB -> UMap IdeaDict
termTable ChunkDB
db) [(UID, [String])] -> [(UID, [String])] -> [(UID, [String])]
forall a. [a] -> [a] -> [a]
++
((UID, (ConceptChunk, Int)) -> (UID, [String]))
-> [(UID, (ConceptChunk, Int))] -> [(UID, [String])]
forall a b. (a -> b) -> [a] -> [b]
map (\x :: (UID, (ConceptChunk, Int))
x -> ((UID, (ConceptChunk, Int)) -> UID
forall a b. (a, b) -> a
fst (UID, (ConceptChunk, Int))
x, ["ConceptChunk"])) (UMap ConceptChunk -> [(UID, (ConceptChunk, Int))]
forall k a. Map k a -> [(k, a)]
Map.assocs (UMap ConceptChunk -> [(UID, (ConceptChunk, Int))])
-> UMap ConceptChunk -> [(UID, (ConceptChunk, Int))]
forall a b. (a -> b) -> a -> b
$ ChunkDB -> UMap ConceptChunk
defTable ChunkDB
db) [(UID, [String])] -> [(UID, [String])] -> [(UID, [String])]
forall a. [a] -> [a] -> [a]
++
((UID, (UnitDefn, Int)) -> (UID, [String]))
-> [(UID, (UnitDefn, Int))] -> [(UID, [String])]
forall a b. (a -> b) -> [a] -> [b]
map (\x :: (UID, (UnitDefn, Int))
x -> ((UID, (UnitDefn, Int)) -> UID
forall a b. (a, b) -> a
fst (UID, (UnitDefn, Int))
x, ["UnitDefn"])) (UMap UnitDefn -> [(UID, (UnitDefn, Int))]
forall k a. Map k a -> [(k, a)]
Map.assocs (UMap UnitDefn -> [(UID, (UnitDefn, Int))])
-> UMap UnitDefn -> [(UID, (UnitDefn, Int))]
forall a b. (a -> b) -> a -> b
$ ChunkDB
db ChunkDB
-> Getting (UMap UnitDefn) ChunkDB (UMap UnitDefn) -> UMap UnitDefn
forall s a. s -> Getting a s a -> a
^. Getting (UMap UnitDefn) ChunkDB (UMap UnitDefn)
Lens' ChunkDB (UMap UnitDefn)
unitTable) [(UID, [String])] -> [(UID, [String])] -> [(UID, [String])]
forall a. [a] -> [a] -> [a]
++
((UID, (DataDefinition, Int)) -> (UID, [String]))
-> [(UID, (DataDefinition, Int))] -> [(UID, [String])]
forall a b. (a -> b) -> [a] -> [b]
map (\x :: (UID, (DataDefinition, Int))
x -> ((UID, (DataDefinition, Int)) -> UID
forall a b. (a, b) -> a
fst (UID, (DataDefinition, Int))
x, ["DataDefinition"])) (UMap DataDefinition -> [(UID, (DataDefinition, Int))]
forall k a. Map k a -> [(k, a)]
Map.assocs (UMap DataDefinition -> [(UID, (DataDefinition, Int))])
-> UMap DataDefinition -> [(UID, (DataDefinition, Int))]
forall a b. (a -> b) -> a -> b
$ ChunkDB
db ChunkDB
-> Getting (UMap DataDefinition) ChunkDB (UMap DataDefinition)
-> UMap DataDefinition
forall s a. s -> Getting a s a -> a
^. Getting (UMap DataDefinition) ChunkDB (UMap DataDefinition)
Lens' ChunkDB (UMap DataDefinition)
dataDefnTable) [(UID, [String])] -> [(UID, [String])] -> [(UID, [String])]
forall a. [a] -> [a] -> [a]
++
((UID, (InstanceModel, Int)) -> (UID, [String]))
-> [(UID, (InstanceModel, Int))] -> [(UID, [String])]
forall a b. (a -> b) -> [a] -> [b]
map (\x :: (UID, (InstanceModel, Int))
x -> ((UID, (InstanceModel, Int)) -> UID
forall a b. (a, b) -> a
fst (UID, (InstanceModel, Int))
x, ["InstanceModel"])) (UMap InstanceModel -> [(UID, (InstanceModel, Int))]
forall k a. Map k a -> [(k, a)]
Map.assocs (UMap InstanceModel -> [(UID, (InstanceModel, Int))])
-> UMap InstanceModel -> [(UID, (InstanceModel, Int))]
forall a b. (a -> b) -> a -> b
$ ChunkDB
db ChunkDB
-> Getting (UMap InstanceModel) ChunkDB (UMap InstanceModel)
-> UMap InstanceModel
forall s a. s -> Getting a s a -> a
^. Getting (UMap InstanceModel) ChunkDB (UMap InstanceModel)
Lens' ChunkDB (UMap InstanceModel)
insmodelTable) [(UID, [String])] -> [(UID, [String])] -> [(UID, [String])]
forall a. [a] -> [a] -> [a]
++
((UID, (GenDefn, Int)) -> (UID, [String]))
-> [(UID, (GenDefn, Int))] -> [(UID, [String])]
forall a b. (a -> b) -> [a] -> [b]
map (\x :: (UID, (GenDefn, Int))
x -> ((UID, (GenDefn, Int)) -> UID
forall a b. (a, b) -> a
fst (UID, (GenDefn, Int))
x, ["GeneralDefinition"])) (UMap GenDefn -> [(UID, (GenDefn, Int))]
forall k a. Map k a -> [(k, a)]
Map.assocs (UMap GenDefn -> [(UID, (GenDefn, Int))])
-> UMap GenDefn -> [(UID, (GenDefn, Int))]
forall a b. (a -> b) -> a -> b
$ ChunkDB
db ChunkDB
-> Getting (UMap GenDefn) ChunkDB (UMap GenDefn) -> UMap GenDefn
forall s a. s -> Getting a s a -> a
^. Getting (UMap GenDefn) ChunkDB (UMap GenDefn)
Lens' ChunkDB (UMap GenDefn)
gendefTable) [(UID, [String])] -> [(UID, [String])] -> [(UID, [String])]
forall a. [a] -> [a] -> [a]
++
((UID, (TheoryModel, Int)) -> (UID, [String]))
-> [(UID, (TheoryModel, Int))] -> [(UID, [String])]
forall a b. (a -> b) -> [a] -> [b]
map (\x :: (UID, (TheoryModel, Int))
x -> ((UID, (TheoryModel, Int)) -> UID
forall a b. (a, b) -> a
fst (UID, (TheoryModel, Int))
x, ["TheoryModel"])) (UMap TheoryModel -> [(UID, (TheoryModel, Int))]
forall k a. Map k a -> [(k, a)]
Map.assocs (UMap TheoryModel -> [(UID, (TheoryModel, Int))])
-> UMap TheoryModel -> [(UID, (TheoryModel, Int))]
forall a b. (a -> b) -> a -> b
$ ChunkDB
db ChunkDB
-> Getting (UMap TheoryModel) ChunkDB (UMap TheoryModel)
-> UMap TheoryModel
forall s a. s -> Getting a s a -> a
^. Getting (UMap TheoryModel) ChunkDB (UMap TheoryModel)
Lens' ChunkDB (UMap TheoryModel)
theoryModelTable) [(UID, [String])] -> [(UID, [String])] -> [(UID, [String])]
forall a. [a] -> [a] -> [a]
++
((UID, (ConceptInstance, Int)) -> (UID, [String]))
-> [(UID, (ConceptInstance, Int))] -> [(UID, [String])]
forall a b. (a -> b) -> [a] -> [b]
map (\x :: (UID, (ConceptInstance, Int))
x -> ((UID, (ConceptInstance, Int)) -> UID
forall a b. (a, b) -> a
fst (UID, (ConceptInstance, Int))
x, ["ConceptInstance"])) (UMap ConceptInstance -> [(UID, (ConceptInstance, Int))]
forall k a. Map k a -> [(k, a)]
Map.assocs (UMap ConceptInstance -> [(UID, (ConceptInstance, Int))])
-> UMap ConceptInstance -> [(UID, (ConceptInstance, Int))]
forall a b. (a -> b) -> a -> b
$ ChunkDB
db ChunkDB
-> Getting (UMap ConceptInstance) ChunkDB (UMap ConceptInstance)
-> UMap ConceptInstance
forall s a. s -> Getting a s a -> a
^. Getting (UMap ConceptInstance) ChunkDB (UMap ConceptInstance)
Lens' ChunkDB (UMap ConceptInstance)
conceptinsTable) [(UID, [String])] -> [(UID, [String])] -> [(UID, [String])]
forall a. [a] -> [a] -> [a]
++
((UID, (Section, Int)) -> (UID, [String]))
-> [(UID, (Section, Int))] -> [(UID, [String])]
forall a b. (a -> b) -> [a] -> [b]
map (\x :: (UID, (Section, Int))
x -> ((UID, (Section, Int)) -> UID
forall a b. (a, b) -> a
fst (UID, (Section, Int))
x, ["Section"])) (UMap Section -> [(UID, (Section, Int))]
forall k a. Map k a -> [(k, a)]
Map.assocs (UMap Section -> [(UID, (Section, Int))])
-> UMap Section -> [(UID, (Section, Int))]
forall a b. (a -> b) -> a -> b
$ ChunkDB
db ChunkDB
-> Getting (UMap Section) ChunkDB (UMap Section) -> UMap Section
forall s a. s -> Getting a s a -> a
^. Getting (UMap Section) ChunkDB (UMap Section)
Lens' ChunkDB (UMap Section)
sectionTable) [(UID, [String])] -> [(UID, [String])] -> [(UID, [String])]
forall a. [a] -> [a] -> [a]
++
((UID, (LabelledContent, Int)) -> (UID, [String]))
-> [(UID, (LabelledContent, Int))] -> [(UID, [String])]
forall a b. (a -> b) -> [a] -> [b]
map (\x :: (UID, (LabelledContent, Int))
x -> ((UID, (LabelledContent, Int)) -> UID
forall a b. (a, b) -> a
fst (UID, (LabelledContent, Int))
x, ["LabelledContent"])) (UMap LabelledContent -> [(UID, (LabelledContent, Int))]
forall k a. Map k a -> [(k, a)]
Map.assocs (UMap LabelledContent -> [(UID, (LabelledContent, Int))])
-> UMap LabelledContent -> [(UID, (LabelledContent, Int))]
forall a b. (a -> b) -> a -> b
$ ChunkDB
db ChunkDB
-> Getting (UMap LabelledContent) ChunkDB (UMap LabelledContent)
-> UMap LabelledContent
forall s a. s -> Getting a s a -> a
^. Getting (UMap LabelledContent) ChunkDB (UMap LabelledContent)
Lens' ChunkDB (UMap LabelledContent)
labelledcontentTable) [(UID, [String])] -> [(UID, [String])] -> [(UID, [String])]
forall a. [a] -> [a] -> [a]
++
((UID, (Reference, Int)) -> (UID, [String]))
-> [(UID, (Reference, Int))] -> [(UID, [String])]
forall a b. (a -> b) -> [a] -> [b]
map (\x :: (UID, (Reference, Int))
x -> ((UID, (Reference, Int)) -> UID
forall a b. (a, b) -> a
fst (UID, (Reference, Int))
x, ["Reference"])) (UMap Reference -> [(UID, (Reference, Int))]
forall k a. Map k a -> [(k, a)]
Map.assocs (UMap Reference -> [(UID, (Reference, Int))])
-> UMap Reference -> [(UID, (Reference, Int))]
forall a b. (a -> b) -> a -> b
$ ChunkDB
db ChunkDB
-> Getting (UMap Reference) ChunkDB (UMap Reference)
-> UMap Reference
forall s a. s -> Getting a s a -> a
^. Getting (UMap Reference) ChunkDB (UMap Reference)
Lens' ChunkDB (UMap Reference)
refTable)
mkListAll :: ChunkDB -> [UID]
mkListAll :: ChunkDB -> [UID]
mkListAll db :: ChunkDB
db = [UID] -> [UID]
forall a. Eq a => [a] -> [a]
nub ([UID] -> [UID]) -> [UID] -> [UID]
forall a b. (a -> b) -> a -> b
$ [UID] -> [UID]
forall a. Ord a => [a] -> [a]
sort ([UID] -> [UID]) -> [UID] -> [UID]
forall a b. (a -> b) -> a -> b
$
((UID, (QuantityDict, Int)) -> UID)
-> [(UID, (QuantityDict, Int))] -> [UID]
forall a b. (a -> b) -> [a] -> [b]
map (UID, (QuantityDict, Int)) -> UID
forall a b. (a, b) -> a
fst (UMap QuantityDict -> [(UID, (QuantityDict, Int))]
forall k a. Map k a -> [(k, a)]
Map.assocs (UMap QuantityDict -> [(UID, (QuantityDict, Int))])
-> UMap QuantityDict -> [(UID, (QuantityDict, Int))]
forall a b. (a -> b) -> a -> b
$ ChunkDB -> UMap QuantityDict
symbolTable ChunkDB
db) [UID] -> [UID] -> [UID]
forall a. [a] -> [a] -> [a]
++
((UID, (IdeaDict, Int)) -> UID)
-> [(UID, (IdeaDict, Int))] -> [UID]
forall a b. (a -> b) -> [a] -> [b]
map (UID, (IdeaDict, Int)) -> UID
forall a b. (a, b) -> a
fst (UMap IdeaDict -> [(UID, (IdeaDict, Int))]
forall k a. Map k a -> [(k, a)]
Map.assocs (UMap IdeaDict -> [(UID, (IdeaDict, Int))])
-> UMap IdeaDict -> [(UID, (IdeaDict, Int))]
forall a b. (a -> b) -> a -> b
$ ChunkDB -> UMap IdeaDict
termTable ChunkDB
db) [UID] -> [UID] -> [UID]
forall a. [a] -> [a] -> [a]
++
((UID, (ConceptChunk, Int)) -> UID)
-> [(UID, (ConceptChunk, Int))] -> [UID]
forall a b. (a -> b) -> [a] -> [b]
map (UID, (ConceptChunk, Int)) -> UID
forall a b. (a, b) -> a
fst (UMap ConceptChunk -> [(UID, (ConceptChunk, Int))]
forall k a. Map k a -> [(k, a)]
Map.assocs (UMap ConceptChunk -> [(UID, (ConceptChunk, Int))])
-> UMap ConceptChunk -> [(UID, (ConceptChunk, Int))]
forall a b. (a -> b) -> a -> b
$ ChunkDB -> UMap ConceptChunk
defTable ChunkDB
db) [UID] -> [UID] -> [UID]
forall a. [a] -> [a] -> [a]
++
((UID, (UnitDefn, Int)) -> UID)
-> [(UID, (UnitDefn, Int))] -> [UID]
forall a b. (a -> b) -> [a] -> [b]
map (UID, (UnitDefn, Int)) -> UID
forall a b. (a, b) -> a
fst (UMap UnitDefn -> [(UID, (UnitDefn, Int))]
forall k a. Map k a -> [(k, a)]
Map.assocs (UMap UnitDefn -> [(UID, (UnitDefn, Int))])
-> UMap UnitDefn -> [(UID, (UnitDefn, Int))]
forall a b. (a -> b) -> a -> b
$ ChunkDB
db ChunkDB
-> Getting (UMap UnitDefn) ChunkDB (UMap UnitDefn) -> UMap UnitDefn
forall s a. s -> Getting a s a -> a
^. Getting (UMap UnitDefn) ChunkDB (UMap UnitDefn)
Lens' ChunkDB (UMap UnitDefn)
unitTable) [UID] -> [UID] -> [UID]
forall a. [a] -> [a] -> [a]
++
((UID, [UID]) -> UID) -> [(UID, [UID])] -> [UID]
forall a b. (a -> b) -> [a] -> [b]
map (UID, [UID]) -> UID
forall a b. (a, b) -> a
fst (Map UID [UID] -> [(UID, [UID])]
forall k a. Map k a -> [(k, a)]
Map.assocs (Map UID [UID] -> [(UID, [UID])])
-> Map UID [UID] -> [(UID, [UID])]
forall a b. (a -> b) -> a -> b
$ ChunkDB
db ChunkDB
-> Getting (Map UID [UID]) ChunkDB (Map UID [UID]) -> Map UID [UID]
forall s a. s -> Getting a s a -> a
^. Getting (Map UID [UID]) ChunkDB (Map UID [UID])
Lens' ChunkDB (Map UID [UID])
traceTable) [UID] -> [UID] -> [UID]
forall a. [a] -> [a] -> [a]
++
((UID, [UID]) -> UID) -> [(UID, [UID])] -> [UID]
forall a b. (a -> b) -> [a] -> [b]
map (UID, [UID]) -> UID
forall a b. (a, b) -> a
fst (Map UID [UID] -> [(UID, [UID])]
forall k a. Map k a -> [(k, a)]
Map.assocs (Map UID [UID] -> [(UID, [UID])])
-> Map UID [UID] -> [(UID, [UID])]
forall a b. (a -> b) -> a -> b
$ ChunkDB
db ChunkDB
-> Getting (Map UID [UID]) ChunkDB (Map UID [UID]) -> Map UID [UID]
forall s a. s -> Getting a s a -> a
^. Getting (Map UID [UID]) ChunkDB (Map UID [UID])
Lens' ChunkDB (Map UID [UID])
refbyTable) [UID] -> [UID] -> [UID]
forall a. [a] -> [a] -> [a]
++
((UID, (DataDefinition, Int)) -> UID)
-> [(UID, (DataDefinition, Int))] -> [UID]
forall a b. (a -> b) -> [a] -> [b]
map (UID, (DataDefinition, Int)) -> UID
forall a b. (a, b) -> a
fst (UMap DataDefinition -> [(UID, (DataDefinition, Int))]
forall k a. Map k a -> [(k, a)]
Map.assocs (UMap DataDefinition -> [(UID, (DataDefinition, Int))])
-> UMap DataDefinition -> [(UID, (DataDefinition, Int))]
forall a b. (a -> b) -> a -> b
$ ChunkDB
db ChunkDB
-> Getting (UMap DataDefinition) ChunkDB (UMap DataDefinition)
-> UMap DataDefinition
forall s a. s -> Getting a s a -> a
^. Getting (UMap DataDefinition) ChunkDB (UMap DataDefinition)
Lens' ChunkDB (UMap DataDefinition)
dataDefnTable) [UID] -> [UID] -> [UID]
forall a. [a] -> [a] -> [a]
++
((UID, (InstanceModel, Int)) -> UID)
-> [(UID, (InstanceModel, Int))] -> [UID]
forall a b. (a -> b) -> [a] -> [b]
map (UID, (InstanceModel, Int)) -> UID
forall a b. (a, b) -> a
fst (UMap InstanceModel -> [(UID, (InstanceModel, Int))]
forall k a. Map k a -> [(k, a)]
Map.assocs (UMap InstanceModel -> [(UID, (InstanceModel, Int))])
-> UMap InstanceModel -> [(UID, (InstanceModel, Int))]
forall a b. (a -> b) -> a -> b
$ ChunkDB
db ChunkDB
-> Getting (UMap InstanceModel) ChunkDB (UMap InstanceModel)
-> UMap InstanceModel
forall s a. s -> Getting a s a -> a
^. Getting (UMap InstanceModel) ChunkDB (UMap InstanceModel)
Lens' ChunkDB (UMap InstanceModel)
insmodelTable) [UID] -> [UID] -> [UID]
forall a. [a] -> [a] -> [a]
++
((UID, (GenDefn, Int)) -> UID) -> [(UID, (GenDefn, Int))] -> [UID]
forall a b. (a -> b) -> [a] -> [b]
map (UID, (GenDefn, Int)) -> UID
forall a b. (a, b) -> a
fst (UMap GenDefn -> [(UID, (GenDefn, Int))]
forall k a. Map k a -> [(k, a)]
Map.assocs (UMap GenDefn -> [(UID, (GenDefn, Int))])
-> UMap GenDefn -> [(UID, (GenDefn, Int))]
forall a b. (a -> b) -> a -> b
$ ChunkDB
db ChunkDB
-> Getting (UMap GenDefn) ChunkDB (UMap GenDefn) -> UMap GenDefn
forall s a. s -> Getting a s a -> a
^. Getting (UMap GenDefn) ChunkDB (UMap GenDefn)
Lens' ChunkDB (UMap GenDefn)
gendefTable) [UID] -> [UID] -> [UID]
forall a. [a] -> [a] -> [a]
++
((UID, (TheoryModel, Int)) -> UID)
-> [(UID, (TheoryModel, Int))] -> [UID]
forall a b. (a -> b) -> [a] -> [b]
map (UID, (TheoryModel, Int)) -> UID
forall a b. (a, b) -> a
fst (UMap TheoryModel -> [(UID, (TheoryModel, Int))]
forall k a. Map k a -> [(k, a)]
Map.assocs (UMap TheoryModel -> [(UID, (TheoryModel, Int))])
-> UMap TheoryModel -> [(UID, (TheoryModel, Int))]
forall a b. (a -> b) -> a -> b
$ ChunkDB
db ChunkDB
-> Getting (UMap TheoryModel) ChunkDB (UMap TheoryModel)
-> UMap TheoryModel
forall s a. s -> Getting a s a -> a
^. Getting (UMap TheoryModel) ChunkDB (UMap TheoryModel)
Lens' ChunkDB (UMap TheoryModel)
theoryModelTable) [UID] -> [UID] -> [UID]
forall a. [a] -> [a] -> [a]
++
((UID, (ConceptInstance, Int)) -> UID)
-> [(UID, (ConceptInstance, Int))] -> [UID]
forall a b. (a -> b) -> [a] -> [b]
map (UID, (ConceptInstance, Int)) -> UID
forall a b. (a, b) -> a
fst (UMap ConceptInstance -> [(UID, (ConceptInstance, Int))]
forall k a. Map k a -> [(k, a)]
Map.assocs (UMap ConceptInstance -> [(UID, (ConceptInstance, Int))])
-> UMap ConceptInstance -> [(UID, (ConceptInstance, Int))]
forall a b. (a -> b) -> a -> b
$ ChunkDB
db ChunkDB
-> Getting (UMap ConceptInstance) ChunkDB (UMap ConceptInstance)
-> UMap ConceptInstance
forall s a. s -> Getting a s a -> a
^. Getting (UMap ConceptInstance) ChunkDB (UMap ConceptInstance)
Lens' ChunkDB (UMap ConceptInstance)
conceptinsTable) [UID] -> [UID] -> [UID]
forall a. [a] -> [a] -> [a]
++
((UID, (Section, Int)) -> UID) -> [(UID, (Section, Int))] -> [UID]
forall a b. (a -> b) -> [a] -> [b]
map (UID, (Section, Int)) -> UID
forall a b. (a, b) -> a
fst (UMap Section -> [(UID, (Section, Int))]
forall k a. Map k a -> [(k, a)]
Map.assocs (UMap Section -> [(UID, (Section, Int))])
-> UMap Section -> [(UID, (Section, Int))]
forall a b. (a -> b) -> a -> b
$ ChunkDB
db ChunkDB
-> Getting (UMap Section) ChunkDB (UMap Section) -> UMap Section
forall s a. s -> Getting a s a -> a
^. Getting (UMap Section) ChunkDB (UMap Section)
Lens' ChunkDB (UMap Section)
sectionTable) [UID] -> [UID] -> [UID]
forall a. [a] -> [a] -> [a]
++
((UID, (LabelledContent, Int)) -> UID)
-> [(UID, (LabelledContent, Int))] -> [UID]
forall a b. (a -> b) -> [a] -> [b]
map (UID, (LabelledContent, Int)) -> UID
forall a b. (a, b) -> a
fst (UMap LabelledContent -> [(UID, (LabelledContent, Int))]
forall k a. Map k a -> [(k, a)]
Map.assocs (UMap LabelledContent -> [(UID, (LabelledContent, Int))])
-> UMap LabelledContent -> [(UID, (LabelledContent, Int))]
forall a b. (a -> b) -> a -> b
$ ChunkDB
db ChunkDB
-> Getting (UMap LabelledContent) ChunkDB (UMap LabelledContent)
-> UMap LabelledContent
forall s a. s -> Getting a s a -> a
^. Getting (UMap LabelledContent) ChunkDB (UMap LabelledContent)
Lens' ChunkDB (UMap LabelledContent)
labelledcontentTable) [UID] -> [UID] -> [UID]
forall a. [a] -> [a] -> [a]
++
((UID, (Reference, Int)) -> UID)
-> [(UID, (Reference, Int))] -> [UID]
forall a b. (a -> b) -> [a] -> [b]
map (UID, (Reference, Int)) -> UID
forall a b. (a, b) -> a
fst (UMap Reference -> [(UID, (Reference, Int))]
forall k a. Map k a -> [(k, a)]
Map.assocs (UMap Reference -> [(UID, (Reference, Int))])
-> UMap Reference -> [(UID, (Reference, Int))]
forall a b. (a -> b) -> a -> b
$ ChunkDB
db ChunkDB
-> Getting (UMap Reference) ChunkDB (UMap Reference)
-> UMap Reference
forall s a. s -> Getting a s a -> a
^. Getting (UMap Reference) ChunkDB (UMap Reference)
Lens' ChunkDB (UMap Reference)
refTable)