Safe Haskell | None |
---|
HSE.Bracket
- class Brackets a where
- remParen :: a -> Maybe a
- addParen :: a -> a
- isAtom :: a -> Bool
- needBracket :: Int -> a -> a -> Bool
- paren :: Exp_ -> Exp_
- descendBracket :: (Exp_ -> (Bool, Exp_)) -> Exp_ -> Exp_
- transformBracket :: (Exp_ -> Maybe Exp_) -> Exp_ -> Exp_
- rebracket1 :: Exp_ -> Exp_
- appsBracket :: [Exp_] -> Exp_
Documentation
class Brackets a where
Methods
remParen :: a -> Maybe a
addParen :: a -> a
isAtom :: a -> Bool
Is this item lexically requiring no bracketing ever i.e. is totally atomic
needBracket :: Int -> a -> a -> Bool
Is the child safe free from brackets in the parent position. Err on the side of caution, True = don't know
descendBracket :: (Exp_ -> (Bool, Exp_)) -> Exp_ -> Exp_
Descend, and if something changes then add/remove brackets appropriately
transformBracket :: (Exp_ -> Maybe Exp_) -> Exp_ -> Exp_
rebracket1 :: Exp_ -> Exp_
Add/remove brackets as suggested needBracket at 1-level of depth
appsBracket :: [Exp_] -> Exp_