Live data from Hacker News

Conrad Barski's Haskell Tutorial

lisperati.com

11–20 of 42 posts

Re: Conrad Barski's Haskell Tutorial

#11
post #8
post #7

Earlier quoted context omitted.

`brew install haskell-platform` should help.

[deleted]

Nope. I just did it. Worked fine for me. If you are talking about that very first exercise, you did put it in a file and run it? Right?

I got the expected output no issues.

Re: Conrad Barski's Haskell Tutorial

#13
post #8
post #7

Earlier quoted context omitted.

`brew install haskell-platform` should help.

[deleted]

It doesn't seem to be outdated. I guess you probably didn't follow correctly the instructions (or maybe they aren't explained well). The extra code given in the second example goes just after the code in the first example, starting with the same indentation. Something like:

    main = do 
      putStr "Hello World! Let's have a picnic! \n"
      people_text 

Re: Conrad Barski's Haskell Tutorial

#14
post #10
post #6

> In Haskell, this type of integer can't get bigger than 2^31... It's platform-dependent h> finiteBitSize (0 :: Int) 64 > We could have used the type Integer instead- This type of integer grows "magically" and can hold any sized integer, no matter how big... but it's slower, so we used Int instead, since our numbers will never get that big. Premature optimisation at its best.

In Haskell you can also use the Integral typeclass to make functions polymorphic to Int and Integer.

And why would you do this in simple tutorial program? Anyway, you'd need Num.

Re: Conrad Barski's Haskell Tutorial

#15
post #8

Earlier quoted context omitted.

[deleted]

It doesn't seem to be outdated. I guess you probably didn't follow correctly the instructions (or maybe they aren't explained well). The extra code given in the second example goes just after the code in the first example, starting with the same indentation. Something like: main = do putStr "Hello World! Let's have a picnic! \n" people_text

You're right, it was lack of indentation.

Re: Conrad Barski's Haskell Tutorial

#16
post #6

> In Haskell, this type of integer can't get bigger than 2^31... It's platform-dependent h> finiteBitSize (0 :: Int) 64 > We could have used the type Integer instead- This type of integer grows "magically" and can hold any sized integer, no matter how big... but it's slower, so we used Int instead, since our numbers will never get that big. Premature optimisation at its best.

[deleted]

Re: Conrad Barski's Haskell Tutorial

#18
post #3

Wow, how did my Haskell tutorial get to the HN front page out of nowhere? :-) If you like my stuff, keep an eye out for my new Bitcoin book, which will be coming out this fall. I've been slaving over the artwork for months, it should be a beautiful book! The working title is "Bitcoins for the Befuddled".

Thanks for the wonderful Land of Lisp book!

I only wish someone would do a similar "Land of C" book some day :-)

Re: Conrad Barski's Haskell Tutorial

#19
post #3

Wow, how did my Haskell tutorial get to the HN front page out of nowhere? :-) If you like my stuff, keep an eye out for my new Bitcoin book, which will be coming out this fall. I've been slaving over the artwork for months, it should be a beautiful book! The working title is "Bitcoins for the Befuddled".

drcode, do you know of a Haskell implementation of bitcoind?

Re: Conrad Barski's Haskell Tutorial

#20
post #14
post #10

Earlier quoted context omitted.

In Haskell you can also use the Integral typeclass to make functions polymorphic to Int and Integer.

And why would you do this in simple tutorial program? Anyway, you'd need Num.

I don't know why anyone would use the Integral typeclass over just Int or Integer in a simple program like this, but you wouldn't need Num in addition to Integral, every instance of Integral must also be an instance of Real, and instances of Real must be instances of Num.
Post reply on HN