[Haskell-cafe] Best Introduction To Monads For Newbies ( Especially Imparative Minds) I'v Ever Read!!!

2006-10-18 Thread Kaveh Shahbazian
This is the best introduction to Monads for newbies and imparative mined that I'v ever read! For a long time I was searching for such an excellent text on monads. Ofcourse there are many good text there. But all of them are about mathematics and how clever the monads are. After all most of them

Re: [Haskell-cafe] Type level functions (type of decreasing list)

2006-10-18 Thread Stefan Holdermans
Greg, What about the following (tested with GHC 6.6)? {-# OPTIONS -fglasgow-exts #-} data Zero = Zero data Succ n = Succ n zero = Zero one = Succ zero two = Succ one three = Succ two -- etc data Seq :: * - * where Nil :: Seq Zero Cons :: Succ n - Seq n - Seq

[Haskell-cafe] Re: type level functions (type of decreasing list)

2006-10-18 Thread oleg
Greg Buchholz wrote: I'm wondering about creating a data structure that has the type of decreasing numbers. I can try... class Pre a b | a - b instance Pre (Succ a) a instance Pre Zero Zero data (Pre a b) = Seq a = Cons a (Seq b) | Nil decreasing = Cons three (Cons two (Cons one

[Haskell-cafe] Re: 6.4 - 6.6, scoped type variables

2006-10-18 Thread oleg
I too miss the old way of handling local type variables. Previously, local type annotations worked a lot like an additional constraint, with type variables denoting some type. The same type variable denoted the same type. Here's how it works in OCaml, for example: # let pair x y = (x,y);; val

Re: [Haskell-cafe] Newbie and working with IO Int and Int

2006-10-18 Thread Ketil Malde
Daniel Fischer [EMAIL PROTECTED] writes: ghci-6.6 [prints the result of IO actions] by default I consider printing the value when it is used in an assignment a bug. It makes it more difficult to test laziness issues or behavior on e.g. large files. Anybody know why it was changed to the

Re: [Haskell-cafe] Newbie and working with IO Int and Int

2006-10-18 Thread Daniel Fischer
Am Mittwoch, 18. Oktober 2006 09:35 schrieb Ketil Malde: Daniel Fischer [EMAIL PROTECTED] writes: ghci-6.6 [prints the result of IO actions] by default I consider printing the value when it is used in an assignment a bug. It makes it more difficult to test laziness issues or behavior on

[Haskell-cafe] Re: optimization help

2006-10-18 Thread apfelmus
Time to write actual code and do some measurements :) The code attached at the end of the message gets compiled with -O2. Writing a sample test file happens with (writeTest #columns #rows) like in writeTest 4 50 (~7 seconds, ~770MB heap (=:-o), 3MB test file). I assume the heap spaces from

Re: [Haskell-cafe] Error building Edison 1.2.0.1

2006-10-18 Thread Robert Dockins
On Oct 17, 2006, at 1:46 PM, Gregory Wright wrote: On Oct 17, 2006, at 1:07 PM, Robert Dockins wrote: On Oct 17, 2006, at 12:55 PM, Gregory Wright wrote: Hi Rob, I've built Edison 1.2.0.1 using ghc-6.6. (I'm testing the macports, formerly darwinports, packages for the new 6.6

Re: [Haskell-cafe] Re: optimization help

2006-10-18 Thread Bulat Ziganshin
Hello apfelmus, Wednesday, October 18, 2006, 3:22:31 PM, you wrote: smaller input produces a larger output). Your 13 seconds versus 90 seconds makes this even more puzzling. But it looks like writing a CSV file is far more expensive than reading one. Maybe it's not a good idea to call hPut

[Haskell-cafe] Re: [Haskell] Lexically scoped type variables

2006-10-18 Thread Bulat Ziganshin
Hello Simon, Wednesday, October 18, 2006, 12:09:40 PM, you wrote: Other alternatives would be: do something about partial type signatures; or make GADT type inference more sophisticated (and thereby perhaps less predicatable). just one more problem is that this issue is too complicated. i'm

[Haskell-cafe] Re: Lexically scoped type variables

2006-10-18 Thread apfelmus
I think the problem comes from the fact that let (x :: a) = rhs in expr has two interpretations: either the programmer mainly specifies a judgment (\Gamma |- rhs :: a) (f.i. as a guide for type inference) or he just introduces a new variable and sees let as a sugar for (\(x :: a) -

[Haskell-cafe] Re: A better syntax for qualified operators?

2006-10-18 Thread Simon Marlow
Brian Hulley wrote: When you try to write an editor for Haskell (or some subset of it), you quickly discover these areas of Haskell syntax like the above which need to be changed to get an optimum interactive editing experience. I think it *is* possible to adjust the Haskell grammar so that

[Haskell-cafe] Re: optimization help

2006-10-18 Thread apfelmus
Hello Bulat, sorry, I just completely forgot to write down the answer for your post. Can this be remedied? Can there be a version of writeFile which is, in a sense, dual to getContents? this can be solved in other way. here is a program that reads stdin and puts to stdout lines starting

[Haskell-cafe] memory, garbage collection and other newbie's issues

2006-10-18 Thread Andrea Rossato
Hi! I'm a newbie and, as a learning experience, I'm writing a feed reader with hscurses and hxt. For the present time the feed reader just reads a Liferea cache but, as you can imagine, I'm running into the usual newbie problems of memory consumption and garbage collection, probably (I'm not

Re: [Haskell-cafe] memory, garbage collection and other newbie's issues

2006-10-18 Thread Jason Dagit
On 10/18/06, Andrea Rossato [EMAIL PROTECTED] wrote: Hi! I'm a newbie and, as a learning experience, I'm writing a feed reader with hscurses and hxt. For the present time the feed reader just reads a Liferea cache but, as you can imagine, I'm running into the usual newbie problems of memory

[Haskell-cafe] Re: type level functions (type of decreasing list)

2006-10-18 Thread Greg Buchholz
Stefan Holdermans [EMAIL PROTECTED] wrote: What about the following (tested with GHC 6.6)? and [EMAIL PROTECTED] wrote: One way is to use existentials: snip Perhaps a better -- and a more general alternative -- is to use type-level programming to its fullest. Thanks everyone, those are