Hi everyone,

I'm repeatedly wondering why there are no `Functor`, `Foldable` and
`Traversable` instances for `Expr`.

Is this just by lack of motive?
I could help there: I was looking for a function that would tell me if an
expression mentions `makeStatic`. After spending some minutes searching in
the code base, I decided to roll my own thing in `CoreUtils`.
I really couldn't think about a good name, so I settled for
`anyReferenceMatching :: (b -> Bool) -> Expr b -> Bool` and realized that I
could generalize the function to `foldMapExpr :: Monoid m => (b -> m) ->
Expr b -> m`.

Occasionally this need pops up and I really want to avoid writing my own
traversals over the syntax tree. So, would anyone object to a patch
implementing these instances?

Thanks
Sebastian
_______________________________________________
ghc-devs mailing list
ghc-devs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

Reply via email to