{-# LANGUAGE TemplateHaskell #-}
module Language.Drasil.Chunk.NamedArgument (
NamedArgument(..),
narg) where
import Language.Drasil (HasSpace(..), HasSymbol(..), HasUID(..),
Idea(..), MayHaveUnit(..), NamedIdea(..), Quantity, IsArgumentName,
DefinedQuantityDict, Concept, dqdWr, Definition (defn), ConceptDomain (cdom))
import Control.Lens ((^.), makeLenses, view)
newtype NamedArgument = NA {NamedArgument -> DefinedQuantityDict
_qtd :: DefinedQuantityDict}
makeLenses ''NamedArgument
instance HasUID NamedArgument where uid :: Getter NamedArgument UID
uid = (DefinedQuantityDict -> f DefinedQuantityDict)
-> NamedArgument -> f NamedArgument
Iso' NamedArgument DefinedQuantityDict
qtd ((DefinedQuantityDict -> f DefinedQuantityDict)
-> NamedArgument -> f NamedArgument)
-> ((UID -> f UID) -> DefinedQuantityDict -> f DefinedQuantityDict)
-> (UID -> f UID)
-> NamedArgument
-> f NamedArgument
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (UID -> f UID) -> DefinedQuantityDict -> f DefinedQuantityDict
forall c. HasUID c => Getter c UID
Getter DefinedQuantityDict UID
uid
instance NamedIdea NamedArgument where term :: Lens' NamedArgument NP
term = (DefinedQuantityDict -> f DefinedQuantityDict)
-> NamedArgument -> f NamedArgument
Iso' NamedArgument DefinedQuantityDict
qtd ((DefinedQuantityDict -> f DefinedQuantityDict)
-> NamedArgument -> f NamedArgument)
-> ((NP -> f NP) -> DefinedQuantityDict -> f DefinedQuantityDict)
-> (NP -> f NP)
-> NamedArgument
-> f NamedArgument
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (NP -> f NP) -> DefinedQuantityDict -> f DefinedQuantityDict
forall c. NamedIdea c => Lens' c NP
Lens' DefinedQuantityDict NP
term
instance Idea NamedArgument where getA :: NamedArgument -> Maybe String
getA = DefinedQuantityDict -> Maybe String
forall c. Idea c => c -> Maybe String
getA (DefinedQuantityDict -> Maybe String)
-> (NamedArgument -> DefinedQuantityDict)
-> NamedArgument
-> Maybe String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Getting DefinedQuantityDict NamedArgument DefinedQuantityDict
-> NamedArgument -> DefinedQuantityDict
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting DefinedQuantityDict NamedArgument DefinedQuantityDict
Iso' NamedArgument DefinedQuantityDict
qtd
instance Definition NamedArgument where defn :: Lens' NamedArgument Sentence
defn = (DefinedQuantityDict -> f DefinedQuantityDict)
-> NamedArgument -> f NamedArgument
Iso' NamedArgument DefinedQuantityDict
qtd ((DefinedQuantityDict -> f DefinedQuantityDict)
-> NamedArgument -> f NamedArgument)
-> ((Sentence -> f Sentence)
-> DefinedQuantityDict -> f DefinedQuantityDict)
-> (Sentence -> f Sentence)
-> NamedArgument
-> f NamedArgument
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Sentence -> f Sentence)
-> DefinedQuantityDict -> f DefinedQuantityDict
forall c. Definition c => Lens' c Sentence
Lens' DefinedQuantityDict Sentence
defn
instance ConceptDomain NamedArgument where cdom :: NamedArgument -> [UID]
cdom = DefinedQuantityDict -> [UID]
forall c. ConceptDomain c => c -> [UID]
cdom (DefinedQuantityDict -> [UID])
-> (NamedArgument -> DefinedQuantityDict) -> NamedArgument -> [UID]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Getting DefinedQuantityDict NamedArgument DefinedQuantityDict
-> NamedArgument -> DefinedQuantityDict
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting DefinedQuantityDict NamedArgument DefinedQuantityDict
Iso' NamedArgument DefinedQuantityDict
qtd
instance HasSpace NamedArgument where typ :: Getter NamedArgument Space
typ = (DefinedQuantityDict -> f DefinedQuantityDict)
-> NamedArgument -> f NamedArgument
Iso' NamedArgument DefinedQuantityDict
qtd ((DefinedQuantityDict -> f DefinedQuantityDict)
-> NamedArgument -> f NamedArgument)
-> ((Space -> f Space)
-> DefinedQuantityDict -> f DefinedQuantityDict)
-> (Space -> f Space)
-> NamedArgument
-> f NamedArgument
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Space -> f Space) -> DefinedQuantityDict -> f DefinedQuantityDict
forall c. HasSpace c => Getter c Space
Getter DefinedQuantityDict Space
typ
instance HasSymbol NamedArgument where symbol :: NamedArgument -> Stage -> Symbol
symbol = DefinedQuantityDict -> Stage -> Symbol
forall c. HasSymbol c => c -> Stage -> Symbol
symbol (DefinedQuantityDict -> Stage -> Symbol)
-> (NamedArgument -> DefinedQuantityDict)
-> NamedArgument
-> Stage
-> Symbol
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Getting DefinedQuantityDict NamedArgument DefinedQuantityDict
-> NamedArgument -> DefinedQuantityDict
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting DefinedQuantityDict NamedArgument DefinedQuantityDict
Iso' NamedArgument DefinedQuantityDict
qtd
instance Quantity NamedArgument where
instance IsArgumentName NamedArgument where
instance Eq NamedArgument where NamedArgument
a == :: NamedArgument -> NamedArgument -> Bool
== NamedArgument
b = (NamedArgument
a NamedArgument -> Getting UID NamedArgument UID -> UID
forall s a. s -> Getting a s a -> a
^. Getting UID NamedArgument UID
forall c. HasUID c => Getter c UID
Getter NamedArgument UID
uid) UID -> UID -> Bool
forall a. Eq a => a -> a -> Bool
== (NamedArgument
b NamedArgument -> Getting UID NamedArgument UID -> UID
forall s a. s -> Getting a s a -> a
^. Getting UID NamedArgument UID
forall c. HasUID c => Getter c UID
Getter NamedArgument UID
uid)
instance MayHaveUnit NamedArgument where getUnit :: NamedArgument -> Maybe UnitDefn
getUnit = DefinedQuantityDict -> Maybe UnitDefn
forall u. MayHaveUnit u => u -> Maybe UnitDefn
getUnit (DefinedQuantityDict -> Maybe UnitDefn)
-> (NamedArgument -> DefinedQuantityDict)
-> NamedArgument
-> Maybe UnitDefn
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Getting DefinedQuantityDict NamedArgument DefinedQuantityDict
-> NamedArgument -> DefinedQuantityDict
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting DefinedQuantityDict NamedArgument DefinedQuantityDict
Iso' NamedArgument DefinedQuantityDict
qtd
narg :: (Quantity q, MayHaveUnit q, Concept q) => q -> NamedArgument
narg :: forall q.
(Quantity q, MayHaveUnit q, Concept q) =>
q -> NamedArgument
narg = DefinedQuantityDict -> NamedArgument
NA (DefinedQuantityDict -> NamedArgument)
-> (q -> DefinedQuantityDict) -> q -> NamedArgument
forall b c a. (b -> c) -> (a -> b) -> a -> c
. q -> DefinedQuantityDict
forall c.
(Quantity c, Concept c, MayHaveUnit c) =>
c -> DefinedQuantityDict
dqdWr