[Haskell-cafe] Why Haskell?
Simon Peyton-Jones
simonpj at microsoft.com
Wed Jul 26 12:47:09 EDT 2006
Looks possible. But it'd depend on using '>>' not '>>= \_ -> ...', so a
bit fragile.
Simon
| -----Original Message-----
| From: haskell-cafe-bounces at haskell.org
[mailto:haskell-cafe-bounces at haskell.org] On Behalf Of Neil
| Mitchell
| Sent: 23 July 2006 13:57
| To: Bulat Ziganshin
| Cc: haskell-cafe at haskell.org
| Subject: Re: Re[2]: [Haskell-cafe] Why Haskell?
|
| 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
| Haskell-Cafe at haskell.org
| http://www.haskell.org/mailman/listinfo/haskell-cafe
More information about the Haskell-Cafe
mailing list