module Drasil.DocumentLanguage.Units where
import Language.Drasil (Sentence(S, Sy), usymb, MayHaveUnit(getUnit))
toSentence :: (MayHaveUnit u) => u -> Sentence
toSentence :: forall u. MayHaveUnit u => u -> Sentence
toSentence u
x = forall b a. b -> (a -> b) -> Maybe a -> b
maybe (String -> Sentence
S String
"--") (USymb -> Sentence
Sy forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall u. HasUnitSymbol u => u -> USymb
usymb) (forall u. MayHaveUnit u => u -> Maybe UnitDefn
getUnit u
x)
toSentenceUnitless :: (MayHaveUnit u) => u -> Sentence
toSentenceUnitless :: forall u. MayHaveUnit u => u -> Sentence
toSentenceUnitless u
x = forall b a. b -> (a -> b) -> Maybe a -> b
maybe (String -> Sentence
S String
"Unitless") (USymb -> Sentence
Sy forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall u. HasUnitSymbol u => u -> USymb
usymb) (forall u. MayHaveUnit u => u -> Maybe UnitDefn
getUnit u
x)