[Haskell-cafe] Debugging a RecSel Error

2009-04-17 Thread Gü?nther Schmidt
Hi all, I'm trying to find the spot in my source code that triggered a RecSel Exception (No match in record selector ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Synchronising cabal package version with self-reported version

2009-04-17 Thread Denis Bueno
On Fri, Apr 17, 2009 at 20:41, Don Stewart d...@galois.com wrote: dbueno: Hi all, In a command-line app of mine I want to have a --version flag, like many GNU apps do to report their version.  The only way I know to provide the version number is to hardcode it in the source code somewhere.  

Re: [Haskell-cafe] Computing a sorted list of products lazily

2009-04-17 Thread wren ng thornton
Jason Dagit wrote: Hello, A colleague of mine recently asked if I knew of a lazy way to solve the following problem: Given two sets of sorted floating point numbers, can we lazily generate a sorted list of the products from their Cartesian product? The algorithm should return the same result

Re: [Haskell-cafe] wxHaskell not in scope

2009-04-17 Thread minh thu
Hi, you can use http://hpaste.org/ to overcome this problem. Cheers, Thu 2009/4/17 Tsunkiet Man temp.t...@gmail.com: PS: if the indents are wrong, that's because of gmail copy and past, Im so sorry. 2009/4/17 Tsunkiet Man temp.t...@gmail.com Hello, what you suggested worked! Im very

Re: [Haskell-cafe] Parsec question

2009-04-17 Thread minh thu
2009/4/17 Michael P Mossey m...@alumni.caltech.edu: I want to write a parser that can read a file with this format: the file has sections which are demarcated by keywords. Keywords always begin with two forward slashes and consist of letters, digits, and underscore. The text can be anything,

[Haskell-cafe] Re: O LANGUAGE DESIGNER, REMEMBER THE POOR USER

2009-04-17 Thread Benjamin L . Russell
On Thu, 16 Apr 2009 19:04:43 -0500, Matt Morrow moonpa...@gmail.com wrote: This is interesting (and from 1990): http://groups.google.co.uk/group/comp.lang.functional/msg/655bb7bbd0fd8586 (Not sure if this is well-known. It seems like it either is, or it should be. Either way, I just stumbled

Re: [Haskell-cafe] Parsec question

2009-04-17 Thread Michael Mossey
Here's what I've got so far. -- Text is considered everything up to //. However, the problem -- is that this consumes the //. parseText = manyTill anyChar (try (string //)) -- Because the // is already consumed, parseKeyword just grabs -- the available letters. parseKeyword :: Parser String

Re: [Haskell-cafe] RE: [Announce] primes

2009-04-17 Thread Sebastian Fischer
Oh, I just remembered, I'm using ghci. I'll bet that's why I'm so slow. I also did, but after installing the package using cabal. IIRC, cabal compiles with -O2 by default. But if you downloaded the tarball and then loaded the module in ghci without installing it, this is probably the

Re: [Haskell-cafe] Parsec question

2009-04-17 Thread minh thu
You can use 'notFollowedBy' (probably with 'many1' and 'try'). Something like (untested): notFollowedBy (try $ string //) Thu 2009/4/17 Michael Mossey m...@alumni.caltech.edu: Here's what I've got so far. -- Text is considered everything up to //. However, the problem -- is that this

Re: [Haskell-cafe] Parsec question

2009-04-17 Thread Michael Mossey
My confusion is that text is by definition followed by // or eof. minh thu wrote: You can use 'notFollowedBy' (probably with 'many1' and 'try'). Something like (untested): notFollowedBy (try $ string //) Thu 2009/4/17 Michael Mossey m...@alumni.caltech.edu: Here's what I've got so far. --

Re: [Haskell-cafe] Parsec question

2009-04-17 Thread Jason Dusek
2009/04/17 minh thu not...@gmail.com: 2009/04/17 Michael Mossey m...@alumni.caltech.edu: I wonder how I can get the manyTill to be happy with eof before finding the //? I tried parseText = manyTill anyChar (try (string //) | eof) but got a type error. You can use 'notFollowedBy' [...]

Re: [Haskell-cafe] wxHaskell not in scope

2009-04-17 Thread Daniel Fischer
Am Freitag 17 April 2009 01:37:25 schrieb Tsunkiet Man: Hello, what you suggested worked! Im very happy with it. However another error suddenly came up. It sais the last statement in a 'do' must be an expression, he is refering to line 41:45 I change my code to this:

[Haskell-cafe] Haskell Weekly News: Issue 114 - April 17, 2009

2009-04-17 Thread Brent Yorgey
--- Haskell Weekly News http://sequence.complete.org/hwn/20090417 Issue 114 - April 17, 2009 --- Welcome to issue 114 of HWN, a newsletter covering

Re: [Haskell-cafe] RE: [Announce] primes

2009-04-17 Thread michael rice
You're right. Since I'm not familiar with Cabal, I didn't use it. Is there a good tutorial? Docs? Also, I'm running a 32-bit Linux OS. Does one get a significant speed increase by switching to a 64-bit OS? Thanks for the feedback. Michael --- On Fri, 4/17/09, Sebastian Fischer

Re: [Haskell-cafe] types and braces

2009-04-17 Thread Josef Svenningsson
Conor, I'd like to point out a few things that may help you on the way. On Wed, Apr 15, 2009 at 8:58 PM, Conor McBride co...@strictlypositive.org wrote: I don't immediately see what the clash in that context would be - I *think* what you propose should be doable. I'd be interested to know

Re: [Haskell-cafe] glut installation using cabal failed

2009-04-17 Thread Henk-Jan van Tuyl
On Thu, 16 Apr 2009 09:44:44 +0200, Duncan Coutts duncan.cou...@worc.ox.ac.uk wrote: On Wed, 2009-04-15 at 01:53 +0200, Henk-Jan van Tuyl wrote: On Tue, 14 Apr 2009 08:25:52 +0200, Raja Koduru kscr...@gmail.com wrote: hi, I am a beginner to haskell. I am trying to install glut using

RE: [Haskell-cafe] types and braces

2009-04-17 Thread Simon Peyton-Jones
Conor See this, which I've just written for you: http://hackage.haskell.org/trac/ghc/wiki/Commentary/Compiler/Parser (Others: please do add to this new Commentary page.) In any case, my guess is that adding atype ::= '{' qcon '}' ought not to introduce ambiguities. You don't want all of

Re: [Haskell-cafe] Parsec question

2009-04-17 Thread Michael Mossey
Jason Dusek wrote: 2009/04/17 minh thu not...@gmail.com: 2009/04/17 Michael Mossey m...@alumni.caltech.edu: I wonder how I can get the manyTill to be happy with eof before finding the //? I tried parseText = manyTill anyChar (try (string //) | eof) but got a type error. You can use

Re[2]: [Haskell-cafe] RE: [Announce] primes

2009-04-17 Thread Bulat Ziganshin
Hello michael, Friday, April 17, 2009, 6:26:33 PM, you wrote: http://haskell.org/cabal/ You're right. Since I'm not familiar with Cabal, I didn't use it. Is there a good tutorial? Docs? Also, I'm running a 32-bit Linux OS. Does one get a significant speed increase by switching to a

[Haskell-cafe] Re: Parsec question

2009-04-17 Thread Christian Maeder
Michael Mossey wrote: Here's what I have so far. It works, but it's a bit weird to consume the // as part of the text rather than the keyword. That happens because the try( string // ), which is part of the end arg to manyTill, consumes the // when it succeeds. But maybe it is the most natural

Re: [Haskell-cafe] Haskell Weekly News: Issue 114 - April 17, 2009

2009-04-17 Thread Martijn van Steenbergen
Brent Yorgey wrote: The [2]5th Haskell Hackathon is underway in Utrecht! Happy Haskell hacking! An early HWN this week since I will be traveling this weekend (but not, unfortunately, to the Hackathon). Yes! It's been a good day so far; there are lots of projects being worked on. You

[Haskell-cafe] Computing a sorted list of products lazily

2009-04-17 Thread Jason Dagit
Hello, A colleague of mine recently asked if I knew of a lazy way to solve the following problem: Given two sets of sorted floating point numbers, can we lazily generate a sorted list of the products from their Cartesian product? The algorithm should return the same result as: sortProduct a b =

Re: [Haskell-cafe] Computing a sorted list of products lazily

2009-04-17 Thread porges
I did something similar a while ago to solve a problem posted on StackOverflow: http://porg.es/blog/sorted-sums-of-a-sorted-list Henry Laxen generalized my code a little bit so you can pass in any monotonic function (see the comments). I'm not sure of the laziness properties of this, but it

Re: [Haskell-cafe] Computing a sorted list of products lazily

2009-04-17 Thread Bulat Ziganshin
Hello Jason, Saturday, April 18, 2009, 1:41:18 AM, you wrote: The algorithm should return the same result as: sortProduct a b = sort [ x * y | x - a, y - b ] i think it's well-known problem. you should write a function merging infinite list of sorted lists. in assumption that lists are

Re: [Haskell-cafe] Computing a sorted list of products lazily

2009-04-17 Thread Daniel Fischer
Am Freitag 17 April 2009 23:41:18 schrieb Jason Dagit: Hello, A colleague of mine recently asked if I knew of a lazy way to solve the following problem: Given two sets of sorted floating point numbers, can we lazily generate a sorted list of the products from their Cartesian product? If the

Re: [Haskell-cafe] Computing a sorted list of products lazily

2009-04-17 Thread Martijn van Steenbergen
Hi Daniel, I love your solution. Very elegant. Daniel Fischer wrote: sortedProducts xs ys = foldr merge1 [] [map (*x) ys | x - xs] merge1 (x:xs) ys = x:merge xs ys merge1 [] ys = ys merge xs@(x:xt) ys@(y:yt) | x y= x:merge xt ys | otherwise = y:merge xs yt (or remove duplicates,

Re: [Haskell-cafe] Computing a sorted list of products lazily

2009-04-17 Thread Daniel Fischer
Am Samstag 18 April 2009 00:31:50 schrieb Martijn van Steenbergen: Hi Daniel, I love your solution. Very elegant. Daniel Fischer wrote: sortedProducts xs ys = foldr merge1 [] [map (*x) ys | x - xs] merge1 (x:xs) ys = x:merge xs ys merge1 [] ys = ys merge xs@(x:xt) ys@(y:yt)

Re: [Haskell-cafe] Computing a sorted list of products lazily

2009-04-17 Thread Tillmann Rendel
Jason Dagit wrote: A colleague of mine recently asked if I knew of a lazy way to solve the following problem: Given two sets of sorted floating point numbers, can we lazily generate a sorted list of the products from their Cartesian product? The algorithm should return the same result as:

[Haskell-cafe] Announce: funsat-0.6

2009-04-17 Thread Denis Bueno
Hello haskell-cafe, funsat is a modern, DPLL-style SAT solver written in Haskell. Funsat solves formulas in conjunctive normal form and produces a total variable assignment for satisfiable problems. Funsat is intended to be reasonably efficient for practical problems and convenient to use as a

Re: [Haskell-cafe] Parsec question

2009-04-17 Thread Michael P Mossey
I've just about got this parser working, but wondering about something. Turns out I need try inside the lookahead here. parseText :: Parser String parseText = manyTill anyChar $ lookAhead (try (string //)) Without try, if I give it an input with a single slash, like some/text It stops with

Re: [Haskell-cafe] Code Golf

2009-04-17 Thread Sjoerd Visscher
Hi, This one works for all 3 examples you gave: diag = concat . takeWhile (not.null) . foldr1 (flip $ zipWith (flip (++)) . ([]:)) . map ((++ repeat []) . map (:[])) or, using Matt Hellige's pointless fun http://matt.immute.net/content/pointless-fun diag = foldr1 (zipWith (++) $. id

Re: [Haskell-cafe] Parsec question

2009-04-17 Thread Daniel Fischer
Am Samstag 18 April 2009 01:33:44 schrieb Michael P Mossey: I've just about got this parser working, but wondering about something. Turns out I need try inside the lookahead here. parseText :: Parser String parseText = manyTill anyChar $ lookAhead (try (string //)) Without try, if I give it

[Haskell-cafe] Synchronising cabal package version with self-reported version

2009-04-17 Thread Denis Bueno
Hi all, In a command-line app of mine I want to have a --version flag, like many GNU apps do to report their version. The only way I know to provide the version number is to hardcode it in the source code somewhere. That means I have the version number in two places: the .cabal file and the

Re: [Haskell-cafe] Synchronising cabal package version with self-reported version

2009-04-17 Thread Don Stewart
dbueno: Hi all, In a command-line app of mine I want to have a --version flag, like many GNU apps do to report their version. The only way I know to provide the version number is to hardcode it in the source code somewhere. That means I have the version number in two places: the .cabal