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