[Haskell-cafe] Re: First steps in Haskell

2005-12-19 Thread Paul Moore
OOn Mon, 19 Dec 2005 10:50:00 +0100, Wolfgang Jeltsch <[EMAIL PROTECTED]> wrote: >Am Sonntag, 18. Dezember 2005 17:25 schrieb Daniel Carrera: >> [...] > >> This is a real problem for Haskell. I expect that a lot of people try >> Haskell and give up because they can't even write the simplest functi

Re: [Haskell-cafe] comprehension generators from IO [a]'s ?

2005-12-19 Thread Steve Harris
On 12/19/05, Chris Kuklewicz <[EMAIL PROTECTED]> wrote: > Okay...that works. Sweet. > > gdc x = ListT $ getDirectoryContents x > > get3levels top = runListT $ do > b <- gdc top > c <- gdc $ top++('/':b) > d <- gdc $ top++('/':b)++('/':c) > return (b,c,d) Yeah, that's awesome: just as read

Re: [Haskell-cafe] Int vs Integer

2005-12-19 Thread Benjamin Franksen
On Monday 19 December 2005 11:26, Wolfgang Jeltsch wrote: > Am Montag, 19. Dezember 2005 01:10 schrieb Jared Updike: > > Int is for bounded values -2**32 to 2**32 (I think... maybe 2**-31 > > and 2**31 or less if it's boxed?) based on the underlying machine > > representation. > > Not really true.

Re: [Haskell-cafe] Help with division

2005-12-19 Thread Daniel Carrera
Greg Buchholz wrote: Integral division is spelled "div"... Thanks, that worked. The "course material" on the website uses a "/". See the second link from the top, English notes. On page 5, right at the bottom. This course material teaches "Gofer" which it claims is "essentially a subset o

Re: [Haskell-cafe] First steps in Haskell

2005-12-19 Thread Benjamin Franksen
On Monday 19 December 2005 12:13, Daniel Carrera wrote: > Wolfgang Jeltsch wrote: > >>* There's no way for a new user to figure out how to successfully > >> run the simplest Haskell program. > > > > There is! "The Hugs 98 User's Guide" and "The GHC User's Guide". > > Okay, I stand corrected. I rep

Re: [Haskell-cafe] comprehension generators from IO [a]'s ?

2005-12-19 Thread Chris Kuklewicz
Okay...that works. Sweet. gdc x = ListT $ getDirectoryContents x get3levels top = runListT $ do b <- gdc top c <- gdc $ top++('/':b) d <- gdc $ top++('/':b)++('/':c) return (b,c,d) I feel bound to point out http://haskell.org/hawiki/ListTDoneRight which has more to say about the details

Re: [Haskell-cafe] Help with division

2005-12-19 Thread Greg Buchholz
Daniel Carrera wrote: > > Playing around with Haskell... I'm writing a 'choose' function: > --//-- > fac :: Int -> Int > fac 0 = 1 > fac n = n*fac(n-1) > > choose :: Int -> Int -> Int > choose n k = fac(n) / (fac(k) * fac(n-k)) > --//-- > > I'm having problems with the last line. > Integral

[Haskell-cafe] Help with division

2005-12-19 Thread Daniel Carrera
Hello all, Playing around with Haskell... I'm writing a 'choose' function: --//-- fac :: Int -> Int fac 0 = 1 fac n = n*fac(n-1) choose :: Int -> Int -> Int choose n k = fac(n) / (fac(k) * fac(n-k)) --//-- I'm having problems with the last line. --//-- Prelude> :l test.hs Compiling Main

Re: [Haskell-cafe] comprehension generators from IO [a]'s ?

2005-12-19 Thread Andrew Pimlott
On Mon, Dec 19, 2005 at 01:42:19PM -0600, Steve Harris wrote: > What I'm after is something like: > -- (psuedo-code) > [(b,c,d) | >b <- getDirectoryContents a_dir, >c <- getDirectoryContents (a_dir ++ "/" ++ b), >d <- getDirectoryContents (a_dir ++ "/" ++ b ++

Re: [Haskell-cafe] comprehension generators from IO [a]'s ?

2005-12-19 Thread Chris Kuklewicz
Hmmm...I'll poke at it. Steve Harris wrote: > [reposted from haskell mailing list where I got no bites :) ] > > Folks, > I'm new to using monads, and I'd like some help improving a function > definition that I wrote and which works, but for which I think there > should be a clearer way to write i

Re: [Haskell-cafe] Using MonadError within other Monads

2005-12-19 Thread Andrew Pimlott
On Mon, Dec 19, 2005 at 10:21:36PM +1300, Karl Grapone wrote: > I still find monadic signatures a little confusing, I believe ghci > was, at some point, deriving types for f or g that had MonadError in > place of Either String, so I'll have to think carefully about why it > is so different from the

[Haskell-cafe] comprehension generators from IO [a]'s ?

2005-12-19 Thread Steve Harris
[reposted from haskell mailing list where I got no bites :) ] Folks, I'm new to using monads, and I'd like some help improving a function definition that I wrote and which works, but for which I think there should be a clearer way to write it. What I'm after is something like: -- (psuedo-code)

[Haskell-cafe] Array performance is killing me

2005-12-19 Thread Joel Reymont
Folks, I managed to reduce my memory consumption but I have a performance problem now. This is a profiling report from my app. -O was not supplied when compiling the library and the relevant modules are at http://wagerlabs.com/array.tgz. COST CENTREMODULE

[Haskell-cafe] Wiki resources for Re: First steps in Haskell

2005-12-19 Thread Shae Matijs Erisson
"Simon Peyton-Jones" <[EMAIL PROTECTED]> writes: > In any case, I think it'd be great if he, or anyone else, started a Wiki > page on "very first steps in Haskell", along the lines he suggests. > Maybe one exists already? Once it does, it'd be good to point to it > from haskell.org. There's both

[Haskell-cafe] XML Schema for Haskell parsing?

2005-12-19 Thread Dimitry Golubovsky
GCCXML defines some XML schema for the results of a C(++) program parsing. Does there exist any agreed-upon XML schema to represent the results of Haskell program parsing? Thanks. -- Dimitry Golubovsky Anywhere on the Web ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] First steps in Haskell

2005-12-19 Thread Bjorn Lisper
Simon: >Me: >| Actually, I have sometimes wished that the various interactive Haskell >| interfaces had the possibility to enter also declarations interactively >GHCi does. Ah, I see! Does it open a let-environment with a local definition? >ghci> let f x = "hello" >ghci> f True >True Hmm, an i

Re: [Haskell-cafe] First steps in Haskell

2005-12-19 Thread Wolfgang Jeltsch
Am Montag, 19. Dezember 2005 12:13 schrieb Daniel Carrera: > [...] > I guess that Haskell is unique among interpreted languages Haskell is not an "interpreted language". There are Haskell interpreters, there are Haskell compilers. > in that there are two compilers and they work different. The

RE: [Haskell-cafe] First steps in Haskell

2005-12-19 Thread Simon Peyton-Jones
| Actually, I have sometimes wished that the various interactive Haskell | interfaces had the possibility to enter also declarations interactively GHCi does. ghci> let f x = "hello" ghci> f True True But there's no editor -- it's strictly a one-line definition Simon | -Original Message--

Re: [Haskell-cafe] First steps in Haskell

2005-12-19 Thread Bjorn Lisper
Simon P-J: >Daniel is right, by definition. He is a new user. He had difficulty. >That much is incontrovertible. > >While he may seem unusual, perhaps he is only unusual in that he's told >us about his experience rather than trying Perl instead. For which, >much thanks, Daniel! Actually, I have

Re: [Haskell-cafe] First steps in Haskell

2005-12-19 Thread Daniel Carrera
Tomasz Zielonka wrote: I think what Wolfgang meant was that different Haskell implementations may have: - different executable names, so you have to invoke them differently - different options - different style of work etc... Of course, all of them should accept all Haskell 98 programs. Ah. Th

Re: [Haskell-cafe] First steps in Haskell

2005-12-19 Thread Daniel Carrera
Wolfgang Jeltsch wrote: The point is that the visitor should know that he/she might need a document about GHCi if he/she wants to use GHCi. A introductionary document about Haskell might not explain a specific Haskell system. If you read a book which is about C++ in general, it won't tell you

Re: [Haskell-cafe] First steps in Haskell

2005-12-19 Thread Tomasz Zielonka
On Mon, Dec 19, 2005 at 10:14:07AM +, Daniel Carrera wrote: > Wolfgang Jeltsch wrote: > >If you want to know how to feed, for example, Hugs with your Haskell > >program, you might have to have a look at some Hugs documentation. > >Remember that different Haskell implementations like Hugs, GH

Re: [Haskell-cafe] Int vs Integer

2005-12-19 Thread Wolfgang Jeltsch
Am Montag, 19. Dezember 2005 01:10 schrieb Jared Updike: > Int is for bounded values -2**32 to 2**32 (I think... maybe 2**-31 and > 2**31 or less if it's boxed?) based on the underlying machine > representation. Not really true. As far as I remember, the Haskell Report just says that Int covers

Re: [Haskell-cafe] First steps in Haskell

2005-12-19 Thread Wolfgang Jeltsch
Am Sonntag, 18. Dezember 2005 18:02 schrieb Daniel Carrera: > Chris Kuklewicz wrote: > > Almost everything is explained under > > > > http://www.haskell.org/ghc/docs/6.4.1/html/users_guide/ghci.html > > Ok. How would a visitor to the Haskell site find this document? The point is that the visitor s

Re: [Haskell-cafe] First steps in Haskell

2005-12-19 Thread Daniel Carrera
Wolfgang Jeltsch wrote: The problem is that the content of that page, and its links, didn't show me how to write a Haskell program (like you did). If you want to know how to feed, for example, Hugs with your Haskell program, you might have to have a look at some Hugs documentation. Remember t

Re: [Haskell-cafe] First steps in Haskell

2005-12-19 Thread Daniel Carrera
Wolfgang Jeltsch wrote: In addition, Haskells requirement of a main variable is nothing new. Certainly nothing new. I just wish that the documentation I read had told me about it. `ghci fac.hs` doesn't give any errors. I don't understand why loading the file like that is ok but typing the e

Re: [Haskell-cafe] First steps in Haskell

2005-12-19 Thread Wolfgang Jeltsch
Am Sonntag, 18. Dezember 2005 18:04 schrieb Daniel Carrera: > Joel Koerwer wrote: > > Then after you've played with you creation a bit, check out > > http://haskell.org/learning.html > > Thank you. I did find that page, and it was very easy to find. There's a lin

Re: [Haskell-cafe] First steps in Haskell

2005-12-19 Thread Daniel Carrera
Wolfgang Jeltsch wrote: honestly, I have to say that during my years with Haskell, this seems to be the first time that I see somebody trying to enter a Haskell program via the command line of an interactive environment. Well, I tried all three (Hugs, GHCI, GHC). The problem is that the tutor

RE: [Haskell-cafe] First steps in Haskell

2005-12-19 Thread Simon Peyton-Jones
Daniel is right, by definition. He is a new user. He had difficulty. That much is incontrovertible. While he may seem unusual, perhaps he is only unusual in that he's told us about his experience rather than trying Perl instead. For which, much thanks, Daniel! In any case, I think it'd be grea

Re: [Haskell-cafe] First steps in Haskell

2005-12-19 Thread Wolfgang Jeltsch
Am Sonntag, 18. Dezember 2005 17:42 schrieb Daniel Carrera: > Lemmih wrote: > > GHC is a compiler. If you want to compile to a binary then you must > > define a function called 'main'. Otherwise just load the file in ghci > > (`ghci fac.hs`). > > I would expect GHC to be able to compile a program w

Re: [Haskell-cafe] First steps in Haskell

2005-12-19 Thread Wolfgang Jeltsch
Am Sonntag, 18. Dezember 2005 17:25 schrieb Daniel Carrera: > [...] > This is a real problem for Haskell. I expect that a lot of people try > Haskell and give up because they can't even write the simplest function. Hello Daniel, honestly, I have to say that during my years with Haskell, this see

Re: [Haskell-cafe] Using MonadError within other Monads

2005-12-19 Thread Karl Grapone
On 12/19/05, Andrew Pimlott <[EMAIL PROTECTED]> wrote: > [It is best to post questions only to haskell-cafe.] Roger. > > On Mon, Dec 19, 2005 at 03:53:53PM +1300, Karl Grapone wrote: > > I'm having trouble making use of MonadError within another Monad, in > > this case IO. snip > Looking at the s

RE: [Haskell-cafe] +RTS -M800M

2005-12-19 Thread Simon Peyton-Jones
| Is there any chance there is a bug in recent GHCs (or perhaps Linux?) | affecting this? I'm fairly sure I've lately seen Haskell programs | consuming significantly larger amounts of memory than they should be | allowed to, and I can try to isolate a test case if it is of | interest. New bugs a