hlint

Safe HaskellSafe-Infered

HSE.Bracket

Synopsis

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

paren :: Exp_ -> Exp_

Add a Paren around something if it is not atomic

descendBracket :: (Exp_ -> (Bool, Exp_)) -> Exp_ -> Exp_

Descend, and if something changes then add/remove brackets appropriately

rebracket1 :: Exp_ -> Exp_

Add/remove brackets as suggested needBracket at 1-level of depth