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 :: Integer
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 = n * fac
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
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)
$ ghci
Prelude let {
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
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
Joel Koerwer wrote:
Then after you've played with you creation a bit, check out
http://haskell.org/learning.html 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
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 function
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 a beginner
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,
Friday,
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?
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 you hear
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.
Now,
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
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 know!
For
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
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
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
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
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 plans to add
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
[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
22 matches
Mail list logo