Safe Haskell | None |
---|---|
Language | Haskell2010 |
Helper functions for working with source templates
- filterList :: TemplateAnnot a => (Ann e a -> Bool) -> AnnList e a -> AnnList e a
- replaceList :: TemplateAnnot a => [Ann e a] -> AnnList e a -> AnnList e a
- insertWhere :: TemplateAnnot a => Ann e a -> (Maybe (Ann e a) -> Bool) -> (Maybe (Ann e a) -> Bool) -> AnnList e a -> AnnList e a
- insertIndex :: (Maybe (Ann e a) -> Bool) -> (Maybe (Ann e a) -> Bool) -> [Ann e a] -> Maybe Int
- class TemplateAnnot annot where
- child :: SourceTemplate
- opt :: SourceTemplate
- optBefore :: String -> SourceTemplate
- optAfter :: String -> SourceTemplate
- list :: SourceTemplate
- indentedList :: SourceTemplate
- indentedListBefore :: String -> SourceTemplate
- indentedListAfter :: String -> SourceTemplate
- listSep :: String -> SourceTemplate
- listSepBefore :: String -> String -> SourceTemplate
- listSepAfter :: String -> String -> SourceTemplate
- (<>) :: SourceTemplate -> SourceTemplate -> SourceTemplate
Documentation
filterList :: TemplateAnnot a => (Ann e a -> Bool) -> AnnList e a -> AnnList e a Source #
replaceList :: TemplateAnnot a => [Ann e a] -> AnnList e a -> AnnList e a Source #
Replaces the list with a new one with the given elements, keeping the most common separator as the new one.
insertWhere :: TemplateAnnot a => Ann e a -> (Maybe (Ann e a) -> Bool) -> (Maybe (Ann e a) -> Bool) -> AnnList e a -> AnnList e a Source #
Inserts the element in the places where the two positioning functions (one checks the element before, one the element after) allows the placement.
insertIndex :: (Maybe (Ann e a) -> Bool) -> (Maybe (Ann e a) -> Bool) -> [Ann e a] -> Maybe Int Source #
Checks where the element will be inserted given the two positioning functions.
class TemplateAnnot annot where Source #
template :: Simple Lens annot SourceTemplate Source #
fromTemplate :: SourceTemplate -> annot Source #
getTemplate :: annot -> SourceTemplate Source #
opt :: SourceTemplate Source #
optBefore :: String -> SourceTemplate Source #
optAfter :: String -> SourceTemplate Source #
listSep :: String -> SourceTemplate Source #
listSepBefore :: String -> String -> SourceTemplate Source #
listSepAfter :: String -> String -> SourceTemplate Source #
(<>) :: SourceTemplate -> SourceTemplate -> SourceTemplate Source #
Concatenates two source templates to produce a new template with all child elements.