{-# LANGUAGE TemplateHaskell #-}
module Language.Drasil.Printing.PrintingInformation where
import Control.Lens (makeLenses, Lens', (^.))
import SysInfo.Drasil (sysinfodb, SystemInformation)
import Database.Drasil (ChunkDB)
import Language.Drasil (Stage(..))
data Notation = Scientific
| Engineering
class HasPrintingOptions c where
getSetting :: Lens' c Notation
newtype PrintingConfiguration = PC { PrintingConfiguration -> Notation
_notation :: Notation }
makeLenses ''PrintingConfiguration
instance HasPrintingOptions PrintingConfiguration where getSetting :: Lens' PrintingConfiguration Notation
getSetting = Iso' PrintingConfiguration Notation
notation
data PrintingInformation = PI
{ PrintingInformation -> ChunkDB
_ckdb :: ChunkDB
, PrintingInformation -> Stage
_stg :: Stage
, PrintingInformation -> PrintingConfiguration
_configuration :: PrintingConfiguration
}
makeLenses ''PrintingInformation
instance HasPrintingOptions PrintingInformation where getSetting :: Lens' PrintingInformation Notation
getSetting = Lens' PrintingInformation PrintingConfiguration
configuration forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall c. HasPrintingOptions c => Lens' c Notation
getSetting
piSys :: SystemInformation -> Stage -> PrintingConfiguration -> PrintingInformation
piSys :: SystemInformation
-> Stage -> PrintingConfiguration -> PrintingInformation
piSys SystemInformation
si = ChunkDB -> Stage -> PrintingConfiguration -> PrintingInformation
PI (SystemInformation
si forall s a. s -> Getting a s a -> a
^. Lens' SystemInformation ChunkDB
sysinfodb)
defaultConfiguration :: PrintingConfiguration
defaultConfiguration :: PrintingConfiguration
defaultConfiguration = Notation -> PrintingConfiguration
PC Notation
Engineering