[Haskell-cafe] Re: (a - [b]) vs. [a - b]

2007-02-03 Thread apfelmus
Chad Scherrer wrote: Unfortunately, I was trying to give a simplification of the real problem, where the monad is STM instead of []. Based on apfelmus's observation of why they can't be isomorphic, I'm guessing I'm out of luck.

Re: [Haskell-cafe] Suggestions for a hReadUntilStr implementation

2007-02-03 Thread Martin DeMello
On 2/3/07, Matt Revelle [EMAIL PROTECTED] wrote: hReadUntilStr :: (Num a) = Handle - String - a - IO (String, Bool) Is this the wrong way to think about the problem? If so, how should it be handled? If not, any ideas on the implementation? Sounds like this would grow into a full-fledged

Re: [Haskell-cafe] Alternate instance Show (Maybe a)?

2007-02-03 Thread Bjorn Bringert
On Feb 2, 2007, at 21:10 , Sergey Zaharchenko wrote: Hello list, Suppose I want show Nothing to return , and show (Just foo) return show foo. I don't seem to be able to. Looks like I either have to use some other function name, like `mShow', or have to import Prelude hiding Maybe,

Re: [Haskell-cafe] Re: (a - [b]) vs. [a - b]

2007-02-03 Thread Tomasz Zielonka
On Sat, Feb 03, 2007 at 10:13:17AM +0100, [EMAIL PROTECTED] wrote: Chad Scherrer wrote: So in reality, I'm trying to construct something like f :: (a - STM b) - STM (a - b) Indeed, such an f most likely does not exist. Yes, consider: f readTVar :: STM (TVar c - c) That would be pretty

Re: [Haskell-cafe] How did you stumble on Haskell?

2007-02-03 Thread Lennart Augustsson
On Jan 29, 2007, at 03:01 , Alexy Khrabrov wrote: How do people stumble on Haskell? Well, I didn't really stumble on it. I was at the 1987 meeting when we decided to define Haskell. But I stumbled on functional programming in the first place. I had to learn it because it was part of a

Re: [Haskell-cafe] How did you stumble on Haskell?

2007-02-03 Thread Joel Reymont
I'll go for the shortest story... I stumbled upon Simon's Composing Financial Contracts paper, Simon was gracious enough to spend a fair bit of time on the phone with me. The rest is history :-). Joel -- http://wagerlabs.com/ ___

[Haskell-cafe] Re: How did you stumble on Haskell?

2007-02-03 Thread Jón Fairbairn
Lennart Augustsson [EMAIL PROTECTED] writes: On Jan 29, 2007, at 03:01 , Alexy Khrabrov wrote: How do people stumble on Haskell? Well, I didn't really stumble on it. I was at the 1987 meeting when we decided to define Haskell. But I stumbled on functional programming in the first

Re: [Haskell-cafe] How did you stumble on Haskell?

2007-02-03 Thread Paul Johnson
In about 93 or 94 a colleague had talked to me about this wierd language called Haskell. At the time I hadn't listened because I was sure that Eiffel was the future. Besides, he had showed me a GUI demo: a calculator that took about half a second to register a button click. So I concluded

[Haskell-cafe] Re: How did you stumble on Haskell?

2007-02-03 Thread Jón Fairbairn
Paul Johnson [EMAIL PROTECTED] writes: I'd read Eric Raymond's piece about being a hacker, where he said to learn Lisp for the side effects. Much better to learn Haskell for the side effects! ;-) -- Jón Fairbairn [EMAIL PROTECTED]

Re: [Haskell-cafe] How did you stumble on Haskell?

2007-02-03 Thread Colin Paul Adams
Paul == Paul Johnson [EMAIL PROTECTED] writes: Paul because I was sure that Eiffel was the future. You were right! Paul It had become painfully Paul obvious that Eiffel wasn't going anywhere. Hm. Why do I make a living at it then? And why is there now an ECMA standard for it?

[Haskell-cafe] Proposal for allowing more use of layout to avoid parentheses and commas

2007-02-03 Thread Brian Hulley
Hi, Following a recent thread on the Haskell' mailing list about the nusiance of having to deal with commas in tuples (when cutting and pasting things to re-order the elements there's always a pesky comma left over in the wrong place), I've written up a proposal for a very simple syntax tweak

Re: [Haskell-cafe] Alternate instance Show (Maybe a)?

2007-02-03 Thread Yitzchak Gale
Hi Sergey, You wrote: Suppose I want show Nothing to return , and show (Just foo) return show foo. I don't seem to be able to. Looks like I either have to use some other function name, like `mShow' That is correct. Show instances are supposed to follow the convention that show x is a Haskell

[Haskell-cafe] Space Leak Help

2007-02-03 Thread Dominic Steinitz
I have re-written SHA1 so that is more idiomatically haskell and it is easy to see how it implements the specification. The only problem is I now have a space leak. I can see where the leak is but I'm less sure what to do about getting rid of it. Here's the offending function: pad :: [Word8]

Re: [Haskell-cafe] Space Leak Help

2007-02-03 Thread kahl
I have re-written SHA1 so that is more idiomatically haskell and it is easy to see how it implements the specification. The only problem is I now have a space leak. I can see where the leak is but I'm less sure what to do about getting rid of it. Here's the offending

Re: [Haskell-cafe] Space Leak Help

2007-02-03 Thread Pepe Iborra
hi Dominic Explicit recursion works just fine for me and keeps things simple: pad :: [Word8] - [Word8] pad xs = pad' xs 0 pad' (x:xs) l = x : pad' xs (succ l) pad' [] l = [0x80] ++ ps ++ lb where pl = (64-(l+9)) `mod` 64 ps = replicate pl 0x00 lb = i2osp 8 (8*l) at the

Re: [Haskell-cafe] Suggestions for a hReadUntilStr implementation

2007-02-03 Thread Greg Fitzgerald
Hi Matt, hReadUntilStr - that is, a function that takes a Handle as an input source, a String to match, and a Num a as the number of seconds to wait before returning a (String, Bool) where the String is all the text read from the Handle until either matching or timing out and the Bool is true

[Haskell-cafe] The usage of runghc ?

2007-02-03 Thread keepbal
I tried to install haskell-fastcgi ( http://www.cs.chalmers.se/~bringert/darcs/haskell-fastcgi/ ). runghc Setup.hs configure --prefix=$HOME/extra runghc -I$HOME/extra/include Setup.hs build Preprocessing library fastcgi-2006.10.9... FastCGI.hsc:50:21: error: fcgiapp.h: No such file or

Re: [Haskell-cafe] How did you stumble on Haskell?

2007-02-03 Thread Michael Vanier
Lennart, Now you've made me curious. Which paper is this? Is it available for download anywhere? Mike Lennart Augustsson wrote: On Jan 29, 2007, at 03:01 , Alexy Khrabrov wrote: How do people stumble on Haskell? Well, I didn't really stumble on it. I was at the 1987 meeting when we

Re: [Haskell-cafe] How did you stumble on Haskell?

2007-02-03 Thread Lennart Augustsson
A new implementation technique for applicative languages, David A. Turner, Software — Practice and Experience, 9:31–49, 1979. I'm not sure if it's available online. -- Lennart On Feb 4, 2007, at 01:14 , Michael Vanier wrote: Lennart, Now you've made me curious. Which paper is

Re: [Haskell-cafe] The usage of runghc ?

2007-02-03 Thread Lemmih
On 2/4/07, keepbal [EMAIL PROTECTED] wrote: I tried to install haskell-fastcgi ( http://www.cs.chalmers.se/~bringert/darcs/haskell-fastcgi/ ). runghc Setup.hs configure --prefix=$HOME/extra runghc -I$HOME/extra/include Setup.hs build Preprocessing library fastcgi-2006.10.9...

Re: [Haskell-cafe] Suggestions for a hReadUntilStr implementation

2007-02-03 Thread Matt Revelle
Thanks for the responses. Greg, your implementation looks useful but it's a little different than what I was thinking (my apologies, I wasn't very clear). In the implementation you posted, the timeout parameter is used to limit the amount of time spent waiting to read an individual character -

Re: [Haskell-cafe] Alternate instance Show (Maybe a)?

2007-02-03 Thread Sergey Zaharchenko
Hello Yitzchak! Sat, Feb 03, 2007 at 07:54:17PM +0200 you wrote: Show instances are supposed to follow the convention that show x is a Haskell expression that recreates x. In other words, Show is mainly used for debugging, for simple serialization, and for interactive use in a Haskell shell