Simon Marlow wrote:
Neil Mitchell wrote:

Would it not be possible to add a GHC rule like the following:

forall a b . sequence a >> b  = sequence_ a >> b

I'm not sure if thats correct, a valid rule definition, or semantics
preserving, but if it was it would be nice :)

Now there's a good idea!

Well this would work in the case of sequence vs sequence_ but it seems to me that what's really needed is a compiler that can do whole program optimization so that the list building inside sequence would be eliminated in this case (because the list is never used) without needing an ad-hoc re-write rule. Otherwise, a programmer must know about all the re-write rules as well as all the functions, and be able to apply them in their head to calculate what the space/time complexity of their program actually is, which imho is much more difficult than just writing sequence_ in the first place.

Has anyone done work on an equivalent of MLton for Haskell?

Thanks, Brian.
--
Logic empowers us and Love gives us purpose.
Yet still phantoms restless for eras long past,
congealed in the present in unthought forms,
strive mightily unseen to destroy us.

http://www.metamilk.com
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to