Skip to content

Instantly share code, notes, and snippets.

@nushio3
Created January 5, 2012 08:25
Show Gist options
  • Save nushio3/1564246 to your computer and use it in GitHub Desktop.
Save nushio3/1564246 to your computer and use it in GitHub Desktop.
これはどうにかなりませんかねえ ref: http://qiita.com/items/1580
recMapM :: forall a b m. (Data a, Data b, Monad m) => (b -> m b) -> a -> m a
recMapM f x = do
let recurse = gmapM (recMapM f) x
case cast x of
Nothing -> recurse
Just bx -> do
z <- f bx
case cast z of
Nothing -> recurse
Just az -> return az
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment