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

2005-12-18 Thread Andrew Pimlott
[It is best to post questions only to haskell-cafe.] 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. > I've blundered around for a while, trying various combinations of > things, but I don't think

[Haskell-cafe] Using MonadError within other Monads

2005-12-18 Thread Karl Grapone
Hi, I'm having trouble making use of MonadError within another Monad, in this case IO. I've blundered around for a while, trying various combinations of things, but I don't think I've fully cottoned-on to nesting of monads. Following is some code which does not compile, but hopefully shows you wh

Re: [Haskell-cafe] c2hs seems to ignore the types I give it when generating foreign import declarations

2005-12-18 Thread Manuel M T Chakravarty
Benjamin Franksen: > On Monday 12 December 2005 02:17, Manuel M T Chakravarty wrote: > > The darcs version of c2hs > > > > darcs get --partial http://www.cse.unsw.edu.au/~chak/repos/c2hs/ > > > > now permits the use of a `nocode' keyword ... > > Hello > > not directly related, but are there any

Re: [Haskell-cafe] Int vs Integer

2005-12-18 Thread Daniel Carrera
Thanks for the info, and the link. I probably should have guessed the Double vs Float one. I did program in C a while ago... Cheers, Daniel. Jared Updike wrote: 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 machin

Re: [Haskell-cafe] Int vs Integer

2005-12-18 Thread 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. Integer is unbounded (arbitrary precision, i.e. 7489571948579148758174534 is a valid Integer). Double is for floating point values corresponding to C

Re: [Haskell-cafe] Int vs Integer

2005-12-18 Thread Chris Kuklewicz
Daniel Carrera wrote: > Hello all, > > I found a good Haskell tutorial (second link on the Tutorials column) > (now that I know how to run the programs in it). I have a question. > What's the difference between the types Int and Integer? Likewise, > what's the difference between the types Float and

[Haskell-cafe] Int vs Integer

2005-12-18 Thread Daniel Carrera
Hello all, I found a good Haskell tutorial (second link on the Tutorials column) (now that I know how to run the programs in it). I have a question. What's the difference between the types Int and Integer? Likewise, what's the difference between the types Float and Double? Are those just syno

Re: [Haskell-cafe] About print and side-effects

2005-12-18 Thread Sebastian Sylvan
On 12/18/05, Daniel Carrera <[EMAIL PROTECTED]> wrote: > Chris Kuklewicz wrote: > > By nomad you seemed to either be ridiculing or misspelling monad. > > Misspelling. It's a new word for me. I'm not really sure what it means. > I expect it'll take me a while to figure it out. It sounds scary, I kn

Re: [Haskell-cafe] About print and side-effects

2005-12-18 Thread Daniel Carrera
Chris Kuklewicz wrote: By nomad you seemed to either be ridiculing or misspelling monad. Misspelling. It's a new word for me. I'm not really sure what it means. I expect it'll take me a while to figure it out. Thank you for the help. Best, Daniel. -- /\/`) http://oooauthors.org /\/

Re: [Haskell-cafe] About print and side-effects

2005-12-18 Thread Chris Kuklewicz
Daniel Carrera wrote: > Hi all, > > The recent responses to my first question (thanks guys!) included the > following bit: > > main = print (fact 42) You can use a "do" block: main = do print (fact 42) which also works. But for a single thing of type (IO _) the "do" is optional. >

Re: [Haskell-cafe] About print and side-effects

2005-12-18 Thread Anders Höckersten
sön 2005-12-18 klockan 20:22 + skrev Daniel Carrera: > Hi all, > > The recent responses to my first question (thanks guys!) included the > following bit: > > main = print (fact 42) > > > Now, print is a side-effect. Shouldn't it involve a do-block or a nomad > or one of those scary things

[Haskell-cafe] About print and side-effects

2005-12-18 Thread Daniel Carrera
Hi all, The recent responses to my first question (thanks guys!) included the following bit: main = print (fact 42) Now, print is a side-effect. Shouldn't it involve a do-block or a nomad or one of those scary things you hear about when learning about side effects in functional programs? H

RE: Re[2]: [Haskell-cafe] Substring replacements

2005-12-18 Thread Branimir Maksimovic
From: Bulat Ziganshin <[EMAIL PROTECTED]> Reply-To: Bulat Ziganshin <[EMAIL PROTECTED]> To: "Branimir Maksimovic" <[EMAIL PROTECTED]> CC: [EMAIL PROTECTED], Haskell-Cafe@haskell.org Subject: Re[2]: [Haskell-cafe] Substring replacements Date: Fri, 16 Dec 2005 16:51:32 +0300 Hello Branimir, Fr

Re: [Haskell-cafe] First steps in Haskell

2005-12-18 Thread Cale Gibbard
On 18/12/05, Daniel Carrera <[EMAIL PROTECTED]> wrote: > 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? If this > is the correct document for

Re: [Haskell-cafe] First steps in Haskell

2005-12-18 Thread Cale Gibbard
The ordinary usage pattern, which I recall is actually described in a number of the tutorials, and on the wiki, probably in a number of places, is to write your program text into a file with an editor, and then load it at a terminal with either ghci fac.hs or hugs fac.hs. (See http://www.haskell.or

Re: [Haskell-cafe] First steps in Haskell

2005-12-18 Thread Sebastian Sylvan
On 12/18/05, Daniel Carrera <[EMAIL PROTECTED]> wrote: > 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 with a

Re: [Haskell-cafe] First steps in Haskell

2005-12-18 Thread 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. The problem is that the content of that page, and its links, didn't show me how to

Re: [Haskell-cafe] First steps in Haskell

2005-12-18 Thread 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? If this is the correct document for a beginner to start with Haskell, perhaps the site should be update

Re: [Haskell-cafe] First steps in Haskell

2005-12-18 Thread 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 with a function that is not called 'main'. I wouldn't expect it to print a

Re: [Haskell-cafe] First steps in Haskell

2005-12-18 Thread Chris Kuklewicz
Daniel Carrera wrote: >> Hello all, >> >> I'm trying to write the simplest possible Haskell program, and I'm not >> getting anywhere. >> >> I have installed Hugs, GHC and GHCI. I want to run the following program: >> >> fac :: Integer -> Integer >> fac 0 = 1 >> fac n | n > 0 = n * fac (n-1) >> $

Re: [Haskell-cafe] First steps in Haskell

2005-12-18 Thread Joel Koerwer
Try ghci fac.hs. You will then have an interactive session with access to the definitions in your file.Then after you've played with you creation a bit, check out http://haskell.org/learning.html Welcome and enjoy!Joel ___ Haskell-Cafe mailing list Haskel

Re: [Haskell-cafe] First steps in Haskell

2005-12-18 Thread Lemmih
On 12/18/05, Daniel Carrera <[EMAIL PROTECTED]> wrote: > Hello all, > > I'm trying to write the simplest possible Haskell program, and I'm not > getting anywhere. > > I have installed Hugs, GHC and GHCI. I want to run the following program: > > fac :: Integer -> Integer > fac 0 = 1 > fac n | n > 0

[Haskell-cafe] First steps in Haskell

2005-12-18 Thread Daniel Carrera
Hello all, I'm trying to write the simplest possible Haskell program, and I'm not getting anywhere. I have installed Hugs, GHC and GHCI. I want to run the following program: fac :: Integer -> Integer fac 0 = 1 fac n | n > 0 = n * fac (n-1) This is what I see: $ hugs Hugs.Base> fac :: Intege