module Utils ( nodeHasAnnotation , foldNodeChildren ) where import qualified Data.Set as S import Data.String import HieTypes nodeHasAnnotation :: String -> String -> HieAST a -> Bool nodeHasAnnotation :: String -> String -> HieAST a -> Bool nodeHasAnnotation String constructor String ty = (FastString, FastString) -> Set (FastString, FastString) -> Bool forall a. Ord a => a -> Set a -> Bool S.member (String -> FastString forall a. IsString a => String -> a fromString String constructor, String -> FastString forall a. IsString a => String -> a fromString String ty) (Set (FastString, FastString) -> Bool) -> (HieAST a -> Set (FastString, FastString)) -> HieAST a -> Bool forall b c a. (b -> c) -> (a -> b) -> a -> c . NodeInfo a -> Set (FastString, FastString) forall a. NodeInfo a -> Set (FastString, FastString) nodeAnnotations (NodeInfo a -> Set (FastString, FastString)) -> (HieAST a -> NodeInfo a) -> HieAST a -> Set (FastString, FastString) forall b c a. (b -> c) -> (a -> b) -> a -> c . HieAST a -> NodeInfo a forall a. HieAST a -> NodeInfo a nodeInfo foldNodeChildren :: Monoid m => (HieAST a -> m) -> HieAST a -> m foldNodeChildren :: (HieAST a -> m) -> HieAST a -> m foldNodeChildren HieAST a -> m f = (HieAST a -> m) -> [HieAST a] -> m forall (t :: * -> *) m a. (Foldable t, Monoid m) => (a -> m) -> t a -> m foldMap HieAST a -> m f ([HieAST a] -> m) -> (HieAST a -> [HieAST a]) -> HieAST a -> m forall b c a. (b -> c) -> (a -> b) -> a -> c . HieAST a -> [HieAST a] forall a. HieAST a -> [HieAST a] nodeChildren