Hi,

sequence [] = return []
sequence (action:actions) = do x <- action
                               xs <- sequence actions
                               return (x:xs)

sequence_ [] = return ()
sequence_ (action:actions) = do action
                                sequence_ actions

So, by appending an underscore at the end of a name, you massively
improve the runtime behaviour of the program. That to me sounds like a
hack :)

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 :)

Thanks

Neil
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to