[Haskell-cafe] ANN: ReviewBoard 0.1 bindings

2008-05-01 Thread Adam Smyczek
This package is part of a development tool designed to monitor code changes, analyze dependencies etc. Actually, we are still in process to develop the tool and this binding is the first functional ready package others might be interested in as well. The package contains a basic set of API

[Haskell-cafe] Understanding tail recursion and trees

2008-05-01 Thread Edsko de Vries
Hi, I am writing a simple compiler for a small DSL embedded in Haskell, and am struggling to identify and remove the source of a stack error when compiling larger examples. To understand the issues better, I was playing around with tail recursion on trees when I came across the following problem.

Re: [Haskell-cafe] Understanding tail recursion and trees

2008-05-01 Thread Miguel Mitrofanov
Copy-paste approach's failed you. Hint: try removing acountL definition and compiling everything else. -- count with tail calls for the left subtree acountL :: Tree - Integer - Integer acountL (Leaf _) acc = acc + 1 acountL (Branch t1 t2) acc = acountL t1 $! (acountL t2 acc) -- count

[Haskell-cafe] Re: Understanding tail recursion and trees

2008-05-01 Thread Edsko de Vries
Hi, Thanks to Miguel for pointing out my silly error. So at least my understanding of tail recursion is correct :) So then the question becomes: what *is* the best way to write this function? One version I can think of is ecount :: [Tree] - Integer - Integer ecount [] acc =

Re: [Haskell-cafe] Re: Understanding tail recursion and trees

2008-05-01 Thread Felipe Lessa
On Thu, May 1, 2008 at 9:32 AM, Edsko de Vries [EMAIL PROTECTED] wrote: So then the question becomes: what *is* the best way to write this function? I guess it would be simpler to have the counter on the data type and a smart branch constructor: data Tree = Leaf Integer | Branch Integer Tree

[Haskell-cafe] ANN: Haddock version 2.1.0

2008-05-01 Thread David Waern
Hi everyone, I'm pleased to announce Haddock 2.1.0. Hackage page: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/haddock-2.1.0 Changes since last version: * Fix a bug that made links point to the defining module instead of the best one (e.g Int pointing to GHC.Base instead

Re: [Haskell-cafe] Couple of formal questions

2008-05-01 Thread Wouter Swierstra
Hi Creighton, Where could I find a good treatment on data vs. codata the difference between well-founded recursion well-founded(?) corecursion? Bart Jacobs has some good papers on the subject. I found the draft of his book Introduction to Coalgebra quite good:

Re: [Haskell-cafe] Couple of formal questions

2008-05-01 Thread Matt Hellige
On Thu, May 1, 2008 at 9:54 AM, Wouter Swierstra [EMAIL PROTECTED] wrote: Where could I find a good treatment on data vs. codata the difference between well-founded recursion well-founded(?) corecursion? Bart Jacobs has some good papers on the subject. I found the draft of his book

Re: [Haskell-cafe] Haskell Web server

2008-05-01 Thread Adam Smyczek
A great step by step introduction: http://mult.ifario.us/p/wiring-haskell-into-a-fastcgi-web-server On Apr 25, 2008, at 7:28 AM, Cetin Sert wrote: Hi, What is the fastest way to set up a web server that can redirect requests to a haskell application and serve results returned by it? I

Re: [Haskell-cafe] Re: Understanding tail recursion and trees

2008-05-01 Thread Felipe Lessa
On Thu, May 1, 2008 at 9:44 AM, Felipe Lessa [EMAIL PROTECTED] wrote: On Thu, May 1, 2008 at 9:32 AM, Edsko de Vries [EMAIL PROTECTED] wrote: So then the question becomes: what *is* the best way to write this function? I guess it would be simpler to have the counter on the data type and

[Haskell-cafe] Re: Couple of formal questions

2008-05-01 Thread Michael Karcher
Wouter Swierstra [EMAIL PROTECTED] wrote: Hi Creighton, Where could I find a proof that the initial algebras final coalgebras of CPO coincide? I saw this referenced in the Bananas.. paper as a fact, but am not sure where this comes from. I couldn't find the statement you are

Re: [Haskell-cafe] ANN: Haddock version 2.1.0

2008-05-01 Thread Gwern Branwen
On 2008.05.01 15:42:19 +0200, David Waern [EMAIL PROTECTED] scribbled 0.5K characters: Hi everyone, I'm pleased to announce Haddock 2.1.0. Hackage page: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/haddock-2.1.0 Changes since last version: * Fix a bug that made links

Re: [Haskell-cafe] Re: Understanding tail recursion and trees

2008-05-01 Thread Daniil Elovkov
Felipe Lessa wrote: On Thu, May 1, 2008 at 9:44 AM, Felipe Lessa [EMAIL PROTECTED] wrote: On Thu, May 1, 2008 at 9:32 AM, Edsko de Vries [EMAIL PROTECTED] wrote: So then the question becomes: what *is* the best way to write this function? I guess it would be simpler to have the counter on

[Haskell-cafe] Writing an 'expect'-like program with runInteractiveCommand

2008-05-01 Thread Graham Fawcett
Hi folks, I would like to communicate with an external, line-oriented process, which takes a sequence of one-line commands, each returning an arbitrary number of lines, and waits for another command after each response. So, something like: sendCmd :: (Handle, Handle) - String - IO [String] ...

Re: [Haskell-cafe] ANN: Haddock version 2.1.0

2008-05-01 Thread David Waern
No it doesn't, but it's on the TODO list. It needs a fix in GHC. By the way, I'm going to experiment with doing the parsing of comments on the Haddock side instead of in GHC. If that works out, we won't have to fix these things in GHC anymore. If anyone wants to help out with Haddock, the darcs

[Haskell-cafe] Test.QuickCheck.Gen

2008-05-01 Thread Tony Morris
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I am trying to understand the QuickCheck source in a bit of depth and I have noted that a Gen x is a function Int - StdGen - x, however, some of the combinators can at times, fail to ever produce a result by throwing an error. I include an example

[Haskell-cafe] Re: Writing an 'expect'-like program with runInteractiveCommand

2008-05-01 Thread ChrisK
Are you adjusting 'System.IO.hSetBuffering' to NoBuffering for those handles? Graham Fawcett wrote: Hi folks, I would like to communicate with an external, line-oriented process, which takes a sequence of one-line commands, each returning an arbitrary number of lines, and waits for another

[Haskell-cafe] elementary Maybe Monad problem .. sigh

2008-05-01 Thread Galchin, Vasili
data Bozo = Bozo { id :: Int } bonzo :: Maybe Bozo - IO () bonzo maybe_bozo = do if maybe_bozo == (Just (Bozo x)) then return () else return () ~ I want x to be a pattern that matches id ?? Kind regards, Vasili

Re: [Haskell-cafe] elementary Maybe Monad problem .. sigh

2008-05-01 Thread Claude Heiland-Allen
Galchin, Vasili wrote: data Bozo = Bozo { id :: Int } bonzo :: Maybe Bozo - IO () bonzo maybe_bozo = do if maybe_bozo == (Just (Bozo x)) then return () else return () ~ I want x to be a pattern that matches id ?? Try: bonzo (Just

Re: [Haskell-cafe] elementary Maybe Monad problem .. sigh

2008-05-01 Thread Luke Palmer
2008/5/2 Galchin, Vasili [EMAIL PROTECTED]: data Bozo = Bozo { id :: Int } bonzo :: Maybe Bozo - IO () bonzo maybe_bozo = do if maybe_bozo == (Just (Bozo x)) then return () else return () bonzo maybe_bozo = case maybe_bozo of

Re: [Haskell-cafe] elementary Maybe Monad problem .. sigh

2008-05-01 Thread Galchin, Vasili
Sorry .. my example was bad. I want to use x .. in then branch where it occur ... e.g. bonzo :: Maybe Bozo - IO () bonzo maybe_bozo = do case maybe_bozo of Just (Bozo x) - x _- . ?? Thanks, V. On Thu,

Re: [Haskell-cafe] elementary Maybe Monad problem .. sigh

2008-05-01 Thread Galchin, Vasili
Here is a simpler case of what I want to do .. 1) To function1 pass in (Maybe Int). 2) If Nothing then pass nullPtr to C function. 3) If Just 1, then pass a pointer to a 1 to teh same C function. Thanks, Vasili On Thu, May 1, 2008 at 8:18 PM, Galchin, Vasili [EMAIL PROTECTED] wrote: Sorry

[Haskell-cafe] Announce: ghc-core, command line pager for reading GHC Core

2008-05-01 Thread Don Stewart
Just a quick announcement, I've uploaded to hackage 'ghc-core' , a wrapper over ghc for displaying the optimised core and assembly language ghc produces from your programs. The code is colourised by hscolour, and displayed in a pager, git-log style. This will be useful for those who like

Re: [Haskell-cafe] elementary Maybe Monad problem .. sigh

2008-05-01 Thread Evan Laforge
2008/5/1 Galchin, Vasili [EMAIL PROTECTED]: Here is a simpler case of what I want to do .. 1) To function1 pass in (Maybe Int). 2) If Nothing then pass nullPtr to C function. 3) If Just 1, then pass a pointer to a 1 to teh same C function. Check out Foreign.maybeWith.

Re: [Haskell-cafe] Re: Writing an 'expect'-like program with runInteractiveCommand

2008-05-01 Thread Donn Cave
Graham Fawcett wrote: I would like to communicate with an external, line-oriented process, which takes a sequence of one-line commands, each returning an arbitrary number of lines, and waits for another command after each response. So, something like: sendCmd :: (Handle, Handle) - String - IO

Re: [Haskell-cafe] Re: Understanding tail recursion and trees

2008-05-01 Thread Derek Elkins
On Fri, 2008-05-02 at 00:10 +0400, Daniil Elovkov wrote: Felipe Lessa wrote: On Thu, May 1, 2008 at 9:44 AM, Felipe Lessa [EMAIL PROTECTED] wrote: On Thu, May 1, 2008 at 9:32 AM, Edsko de Vries [EMAIL PROTECTED] wrote: So then the question becomes: what *is* the best way to write this