Safe Haskell | None |
---|---|
Language | Haskell2010 |
Language.Haskell.Tools.Refactor.Utils.Helpers
Description
Helper functions for defining refactorings.
Synopsis
- replaceWithJust :: Ann e IdDom SrcTemplateStage -> AnnMaybe e -> AnnMaybe e
- replaceWithNothing :: AnnMaybe e -> AnnMaybe e
- removeEmptyBnds :: Simple Traversal Module ValueBind -> Simple Traversal Module Expr -> Module -> Module
- normalizeElements :: [Ann e dom SrcTemplateStage] -> [Ann e dom SrcTemplateStage]
- groupElemsBy :: Ord k => (a -> k) -> [a] -> [[a]]
- reprElems :: [[a]] -> [(a, [a])]
- equivalenceGroupsBy :: Ord k => (a -> k) -> [a] -> [(a, [a])]
Documentation
replaceWithJust :: Ann e IdDom SrcTemplateStage -> AnnMaybe e -> AnnMaybe e Source #
replaceWithNothing :: AnnMaybe e -> AnnMaybe e Source #
removeEmptyBnds :: Simple Traversal Module ValueBind -> Simple Traversal Module Expr -> Module -> Module Source #
Remove the container (where or let) when the last binding is removed.
normalizeElements :: [Ann e dom SrcTemplateStage] -> [Ann e dom SrcTemplateStage] Source #
Puts the elements in the orginal order and remove duplicates (elements with the same source range)
groupElemsBy :: Ord k => (a -> k) -> [a] -> [[a]] Source #
Groups elements together into equivalence groups.
reprElems :: [[a]] -> [(a, [a])] Source #
Chooses a representative element for each equivalence group, and pairs them with their corresponding group.
equivalenceGroupsBy :: Ord k => (a -> k) -> [a] -> [(a, [a])] Source #
Sorts the elements of a list into equivalence groups based on a function, then chooses a representative element for each group, and pairs them with their corresponding group.