Re: [Haskell-cafe] Laziness enhances composability: an example

2009-07-10 Thread Simon Richard Clarkstone
Thomas Davie wrote: On 9 Jul 2009, at 14:55, Cristiano Paris wrote: I'm wondering what a good example of why laziness enhances composability would be. I'm specifically looking for something that can't implemented in Python with iterators (at least not elegantly), but can actually be

Re: [Haskell-cafe] Re: Sometimes I wish there was a global variable

2009-03-22 Thread Simon Richard Clarkstone
Ok, replying to the list this time. Darn Thunderbird not reading my mind again. Rafael Cunha de Almeida wrote: Maurí­cio wrote: In one module, you can write: -- giveMeFunctions = do { newIORef ... newIORef ... newIORef ... (...) let f1 = ... let f2 = ...

Re: [Haskell-cafe] foldl vs foldl'

2008-11-09 Thread Simon Richard Clarkstone
Bas van Dijk wrote: On Wed, Nov 5, 2008 at 12:43 AM, Bas van Dijk [EMAIL PROTECTED] wrote: 2008/11/5 Daryoush Mehrtash [EMAIL PROTECTED]: Are there cases (function or list) where the result of foldl (or foldr)would be different that foldl' (or foldr')? Maybe this wiki article I wrote some

Re: [Haskell-cafe] Re: is there a way to pretty print a module?

2008-11-02 Thread Simon Richard Clarkstone
Anatoly Yakovenko wrote: is there a way to pretty print a module? like: module Main where import Language.Haskell.TH main = do print $ pprint Main haskell-src should be able to do that. I think haskell-src requires you to read the module at run time. I want to embed the contents of the

Re: [Haskell-cafe] [] vs [()]

2008-10-11 Thread Simon Richard Clarkstone
Sam Danielson wrote: The [] constructor takes no arguments and is like Nothing in the Maybe type. The list : (cons) infix constructor takes two arguments, an element of type a and a list of type a, to construct a new list. Compare to Maybe. data []a = [] | a : [a] data

Re: [Haskell-cafe] Shooting your self in the foot with Haskell

2008-10-11 Thread Simon Richard Clarkstone
John Van Enk wrote: On Sun, Oct 5, 2008 at 11:21 PM, John Van Enk [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: On Sun, Oct 5, 2008 at 6:22 PM, Simon Richard Clarkstone [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: BTW, these could go on the wiki. I'll see about putting them

Re: [Haskell-cafe] Shooting your self in the foot with Haskell

2008-10-05 Thread Simon Richard Clarkstone
John Van Enk wrote: You shoot the gun, but the bullet gets trapped in the IO monad. The community points you at the paper Bang-bang-patterns: expressing lethal weaponry in the Haskell typesystem. Your head explodes. BTW, these could go on the wiki. -- src/ -XIncomprehensibleTypes

Re: [Haskell-cafe] Re: Haskell-Cafe Digest, Vol 61, Issue 49

2008-09-28 Thread Simon Richard Clarkstone
Mark Snyder wrote: whoops! wow, wrong message to reply to... please disregard the previous. Apologies, ~Mark Snyder [Snip entire digest] Ouch. When apologising for quoting the entire digest, quoting your entire previous message doesn't really help the situation :-). grin -- src/

Re: [Haskell-cafe] [m..n] question

2008-09-28 Thread Simon Richard Clarkstone
Jonathan Cast wrote: On Sat, 2008-09-27 at 02:09 +0100, Simon Richard Clarkstone wrote: Darn, I sent this as personal mail the first time. Evan Laforge wrote: In Haskell, The sequence enumFromTo e1 e3 is the list [e1,e1+1,e1+2,...e3]. The list is empty if e1 e3. I like it, since it means

Re: [Haskell-cafe] [m..n] question

2008-09-26 Thread Simon Richard Clarkstone
Darn, I sent this as personal mail the first time. Evan Laforge wrote: In Haskell, The sequence enumFromTo e1 e3 is the list [e1,e1+1,e1+2,...e3]. The list is empty if e1 e3. I like it, since it means that things like [n .. n + length m - 1] work as expected when m is []. Or say 'map

Re: [Haskell-cafe] message passing style in Monad

2008-09-14 Thread Simon Richard Clarkstone
jinjing wrote: I found that as I can do xs.map(+1).sort by redefine . to be a . f = f a infixl 9 . This looks rather like ($), but backwards. I believe the F# name for this operator is (|), which is also a legal name for it in Haskell. Odd, since (|) alone isn't legal. Calling it