
2 Apr
2010
2 Apr
'10
2:26 p.m.
On 3/31/10 12:44, Heinrich Apfelmus wrote:
go Next (Single x t1) = liftM (Single x) (rewrite f t1) go Next (Fork t1 t2 ) = liftM2 Fork (rewrite f t1) (rewrite f t2)
In particular, liftM and liftM2 make it apparent that we're just wrapping the result in a constructor.
A small remark: I prefer using applicative notation for this:
go Next (Single x t1) = Single x <$> rewrite f t1 go Next (Fork t1 t2 ) = Fork <$> rewrite f t1 <*> rewrite f t2
Martijn.