module GHC.SourceGen.Lit.Internal where
import BasicTypes (SourceText(NoSourceText), FractionalLit(..))
import BasicTypes (IntegralLit(..))
import GHC.Hs.Lit
import GHC.SourceGen.Syntax.Internal
noSourceText :: (SourceText -> a) -> a
noSourceText :: (SourceText -> a) -> a
noSourceText = ((SourceText -> a) -> SourceText -> a
forall a b. (a -> b) -> a -> b
$ SourceText
NoSourceText)
litNeedsParen :: HsLit' -> Bool
litNeedsParen :: HsLit' -> Bool
litNeedsParen HsLit'
_ = Bool
False
overLitNeedsParen :: HsOverLit' -> Bool
overLitNeedsParen :: HsOverLit' -> Bool
overLitNeedsParen = OverLitVal -> Bool
needs (OverLitVal -> Bool)
-> (HsOverLit' -> OverLitVal) -> HsOverLit' -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. HsOverLit' -> OverLitVal
forall p. HsOverLit p -> OverLitVal
ol_val
where
needs :: OverLitVal -> Bool
needs (HsIntegral IntegralLit
x) = IntegralLit -> Bool
il_neg IntegralLit
x
needs (HsFractional FractionalLit
x) = FractionalLit -> Bool
fl_neg FractionalLit
x
needs OverLitVal
_ = Bool
False