Re: [Haskell-cafe] coerce (safe!)

2008-03-02 Thread Roman Cheplyaka
* Krzysztof Skrzętnicki [EMAIL PROTECTED] [2008-03-02 01:21:42+0100] Well, it is simply coerce :: a - b coerce _ = undefined so coerce is simply empty function. But still, it is possible to write a function of type (a-b). Well, possibly I didn't write anything particularly new, but

[Haskell-cafe] Re: coerce (safe!)

2008-03-02 Thread Jon Fairbairn
Krzysztof Skrzętnicki [EMAIL PROTECTED] writes: Well, it is simply coerce :: a - b coerce _ = undefined so coerce is simply empty function. But still, it is possible to write a function of type (a-b). Well, possibly I didn't write anything particularly new, but please excuse me for I'm

Re: [Haskell-cafe] Wrong kind when attempting to build a monad for a circular list of functions

2008-03-02 Thread Roel van Dijk
Looks good! A few tips: funcList :: [Int - Int] funcList = [\_ - 1, \_ - 2, \_ - 3] funcList = [const 1, const 2, const 3] iterateCircularFL :: [a - b] - (a - b, [a - b]) iterateCircularFL (x:xs) = (x, concat [xs, [x]]) {- If you use cycle in main then you do not need this function at

Re: [Haskell-cafe] Parody of Darcs patch theory from 1981

2008-03-02 Thread Miguel Mitrofanov
Does it start with Any sequence of KLUDGES, not necessarily distinct or finite...? If so, it can be found in The Computer Contradictionary, by the same author, and probably illegal copy of the last book can be found in the net somewhere. On 2 Mar 2008, at 19:53, Paul Johnson wrote: I was

[Haskell-cafe] Re: Generating a random list

2008-03-02 Thread apfelmus
Albert Y. C. Lai wrote: Note the code of merge: merge cmp xs [] = xs merge cmp [] ys = ys merge cmp (x:xs) (y:ys) = ... Suppose you re-order the first two lines, i.e., make it merge cmp [] ys = ys merge cmp xs [] = xs merge cmp (x:xs) (y:ys) = ... what will happen? Oh, so the mergesort

[Haskell-cafe] Parody of Darcs patch theory from 1981

2008-03-02 Thread Paul Johnson
I was looking through my old copy of The Devil's DP Dictionary by Stan Kelly-Bootle, and came across the entry for Stepwise Refinement. I thought I've seen this before: this is a parody of Darcs patch theory. It included the Null patch, chains of patches, inverse patches, and pseudo-inverse

[Haskell-cafe] A mini haskell (in 244 lines of python)

2008-03-02 Thread Tim Newsham
For education and fun I wrote a small untyped non-strict lambda calculus evaluator in python. One of the goals was to keep it fairly small and simple, and to do most of the work in the implemented scripting language itself. For that reason, I added macros to allow things like let and letrec to

Re: [Haskell-cafe] STAMP benchmark in Haskell?

2008-03-02 Thread Jan-Willem Maessen
On Mar 1, 2008, at 6:41 PM, Tom Davies wrote: I'm experimenting with STM (in CAL[1] rather than Haskell) and want to run the STAMP[2] benchmarks. Hmm, I don'tknow of a particularly good STM-in-Haskell benchmark, but I'd say that the STAMP benchmarks are written in a rather imperative,

Re: [Haskell-cafe] Parody of Darcs patch theory from 1981

2008-03-02 Thread Paul Johnson
Miguel Mitrofanov wrote: Does it start with Any sequence of KLUDGES, not necessarily distinct or finite...? If so, it can be found in The Computer Contradictionary, by the same author, and probably illegal copy of the last book can be found in the net somewhere. Indeed. In fact I'm not even

Re: [Haskell-cafe] coerce (safe!)

2008-03-02 Thread Luke Palmer
2008/3/2 Roman Cheplyaka [EMAIL PROTECTED]: * Krzysztof Skrzętnicki [EMAIL PROTECTED] [2008-03-02 01:21:42+0100] Well, it is simply coerce :: a - b coerce _ = undefined so coerce is simply empty function. But still, it is possible to write a function of type (a-b). Well,

[Haskell-cafe] Space leak - help needed

2008-03-02 Thread Krzysztof Kościuszkiewicz
Dear Haskellers, Another story from an (almost) happy Haskell user that finds himself overwhelmed by laziness/space leaks. I'm trying to parse a large file (600MB) with a single S-expression like structure. With the help of ByteStrings I'm down to 4min processing time in constant space. However,

Re: [Haskell-cafe] Space leak - help needed

2008-03-02 Thread Luke Palmer
On Mon, Mar 3, 2008 at 2:23 AM, Krzysztof Kościuszkiewicz [EMAIL PROTECTED] wrote: Dear Haskellers, Another story from an (almost) happy Haskell user that finds himself overwhelmed by laziness/space leaks. I'm trying to parse a large file (600MB) with a single S-expression like

Re: [Haskell-cafe] Space leak - help needed

2008-03-02 Thread Bertram Felgenhauer
Krzysztof Kościuszkiewicz wrote: Another story from an (almost) happy Haskell user that finds himself overwhelmed by laziness/space leaks. I'm trying to parse a large file (600MB) with a single S-expression like structure. With the help of ByteStrings I'm down to 4min processing time in

Re: [Haskell-cafe] coerce (safe!)

2008-03-02 Thread Bernie Pope
On 03/03/2008, at 8:30 AM, Luke Palmer wrote: 2008/3/2 Roman Cheplyaka [EMAIL PROTECTED]: * Krzysztof Skrzętnicki [EMAIL PROTECTED] [2008-03-02 01:21:42 +0100] Well, it is simply coerce :: a - b coerce _ = undefined so coerce is simply empty function. But still, it is possible to