News for hackers. Stuff that matters.
Re:Conrad Barski's Haskell Tutorial by drcode on Sunday July 14, 2013 @02:53PM (#6041758)
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".

Re:Conrad Barski's Haskell Tutorial by binarycrusader on Sunday July 14, 2013 @07:50PM (#6042783)
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 by p4bl0 on Monday July 15, 2013 @07:19AM (#6044859)
Following the naming pattern, the title would be more like "County of C" ;-).
Re:Conrad Barski's Haskell Tutorial by victorf on Sunday July 14, 2013 @09:17PM (#6043099)
I haven't read that one, and I am looking for an into to Lisp book. What did you like about it?

(and I think it would be a missed opportunity to not title it "Sea of C")

Re:Conrad Barski's Haskell Tutorial by binarycrusader on Monday July 15, 2013 @01:02AM (#6043794)
To be clear, I haven't finished the book yet, but I made it through the first eleven chapters (~230 pages) so I think I've gone through enough material to render a reasonable opinion. With that disclaimer out of the way...

I love that the author chose to expose readers to core, foundational concepts through example programs that were continually improved instead of using lots of throwaway one-off examples.

Put differently, the author managed to ensure that readers that diligently followed through from beginning to end would gain a real sense of progression as they went through the material.

The only complaint I really have so far is Chapter 11 -- but that's not really the author's fault; that's just the terrifyingly mind-numbing formatting functionality (Common?) Lisp offers.

Re:Conrad Barski's Haskell Tutorial by gcv on Monday July 15, 2013 @02:02AM (#6043965)
Seconding the recommendation for Land of Lisp. It's fun, well-written, and thorough. And has the most fun art I've seen in a programming manual.

I read five great books on Common Lisp.

Intro level: ANSI Common Lisp (by our very own PG), Practical Common Lisp, and Land of Lisp. Can't go wrong with any of them, but LoL has art and humor.

Advanced level: On Lisp (again, PG), and Let Over Lambda (a bit rougher around the edges, opinionated, but full of clever programming tricks).

Re:Conrad Barski's Haskell Tutorial by lelf on Monday July 15, 2013 @06:23AM (#6044687)
Read it. How can you not read a book with such a front cover? And it has examples you really want to play with (literally), not 10000 kinds of "hello fibonacci".
Re:Conrad Barski's Haskell Tutorial by icey on Sunday July 14, 2013 @03:17PM (#6041856)
If you're genuinely curious, I found it on the Haskell subreddit today!
Re:Conrad Barski's Haskell Tutorial by jaekwon on Sunday July 14, 2013 @07:58PM (#6042825)
drcode, do you know of a Haskell implementation of bitcoind?
Re:Conrad Barski's Haskell Tutorial by drcode on Sunday July 14, 2013 @09:13PM (#6043077)
No, I have never heard of Haskell and bitcoin in the same sentence. I think you'd have to use an FFI.
Re:Conrad Barski's Haskell Tutorial by dons on Monday July 15, 2013 @03:26AM (#6044182)
Re:Conrad Barski's Haskell Tutorial by drcode on Monday July 15, 2013 @11:28AM (#6046168)
Hi Don... Wow, lot's going on... I should have done a Google search before responding :-)
Re:Conrad Barski's Haskell Tutorial by doublec on Sunday July 14, 2013 @10:28PM (#6043333)
roconnor was working on one. There are git mirrors of the darcs repository on github. For example: https://github.com/laanwj/Purecoin

I don't know the current status of it.

Re:Conrad Barski's Haskell Tutorial by lelf on Sunday July 14, 2013 @03:22PM (#6041871)
> 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.

Re:Conrad Barski's Haskell Tutorial by pogden on Sunday July 14, 2013 @04:59PM (#6042216)
In Haskell you can also use the Integral typeclass to make functions polymorphic to Int and Integer.
Re:Conrad Barski's Haskell Tutorial by lelf on Sunday July 14, 2013 @05:09PM (#6042251)
And why would you do this in simple tutorial program? Anyway, you'd need Num.
Re:Conrad Barski's Haskell Tutorial by dfeltey on Sunday July 14, 2013 @07:59PM (#6042828)
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.
Re:Conrad Barski's Haskell Tutorial by apgwoz on Sunday July 14, 2013 @02:25PM (#6041646)
Picnicmob was a really clever idea. I think I remember that it got cancelled though, which was unfortunate.

I like the tutorial though. I'd be willing to bet it's his style and work that inspired the "Learn you a..." books. The Haskell one is great, and so is the Erlang one.

Re:Conrad Barski's Haskell Tutorial by seako on Sunday July 14, 2013 @04:40PM (#6042154)
don't forget _why's (poignant) guide to ruby http://mislav.uniqpath.com/poignant-guide/
Re:Conrad Barski's Haskell Tutorial by victorf on Sunday July 14, 2013 @09:20PM (#6043112)
I hated that book, the signal to goofy joke ratio was awful. Compare with, say, "Learn you an Erlang", which was goofy while still informative.
Re:Conrad Barski's Haskell Tutorial by apgwoz on Monday July 15, 2013 @09:30AM (#6045354)
I've never read all of the poignant guide, though I probably should for entertainment value. But, yeah, I'd imagine that was also an inspiration.
Re:Conrad Barski's Haskell Tutorial by gtani on Monday July 15, 2013 @09:50AM (#6045464)
My local Barnes and Noble has this book next to Felleisen et al's "Realm of Racket". These will be hours and cups of coffee well spent!

http://realmofracket.com/

Re:Conrad Barski's Haskell Tutorial by gps408 on Monday July 15, 2013 @04:23AM (#6044315)
Simple and refined, guaranteed to blow your mind...

The tao of regular expressions link is broken in the first chapter. Does anyone have a link?

Re:Conrad Barski's Haskell Tutorial by reirob on Wednesday July 24, 2013 @05:59AM (#6095253)
I like the tutorial very much! Thank you! And I like the final words, which I think brings to the point the whole discussion about Haskell vs. Imperative languages:

  [..] Because the physical world changes only slightly 
  from moment to moment, it means that languages that 
  can comfortably mutate large data structures in targeted
  ways will always have a role to play in real-world
  software- The "real world" usually just doesn't work the
  way Haskell, and other functional languages would prefer
  it did: Haskell preferred that at every moment in time, a
  "new universe" would look at the "old universe" and would
  rebuild itself, from scratch, from what it saw in the
  past, with radical changes happening all the time.

  Despite its many advantages, I humbly suggest, therefore,
  that in the future there will continue to be a rift
  between the "imperative" and "functional" camps of
  programming, until someone comes up with a truly robust
  way of uniting these two camps- And I think that some
  profound programming discoveries still need to be made in
  the future before this problem is really resolved- I get
  the feeling it's just not good enough to wave at the
  problem and say "Monads".
Re:Conrad Barski's Haskell Tutorial by frou_dh on Sunday July 14, 2013 @03:10PM (#6041827)
ghc 7.6.3 (brew) installed on OS X doesn't like the first code presented (System.Random, Text.Regex and StdGen aren't found).
Re:Conrad Barski's Haskell Tutorial by mietek on Sunday July 14, 2013 @03:24PM (#6041887)
`brew install haskell-platform` should help.
[deleted]
Re:Conrad Barski's Haskell Tutorial by lelf on Sunday July 14, 2013 @05:03PM (#6042231)
Did you respect indentation?

Tutorial is really failing here with this “just paste this to the bottom”.

Re:Conrad Barski's Haskell Tutorial by chm on Sunday July 14, 2013 @10:32PM (#6043347)
I did respect indentation, and here's what I get as an error:

> tutorial.hs:21:23: Illegal type signature: `[Person] people' Perhaps you intended to use -XScopedTypeVariables In a pattern type-signature

Re:Conrad Barski's Haskell Tutorial by lelf on Monday July 15, 2013 @06:17AM (#6044672)
You copy-pasted it without a newline.

This is how it should look http://lpaste.net/90921

Re:Conrad Barski's Haskell Tutorial by paradoja on Monday July 15, 2013 @04:22AM (#6044310)
I guess you have a little error in your code. Maybe if you copied and pasted there was an error.

For example, if you have

     let people :: [Person] people
instead of

     let people :: [Person]
         people = -- ...
that would give you that error.
Re:Conrad Barski's Haskell Tutorial by paradoja on Sunday July 14, 2013 @05:07PM (#6042246)
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 <- readFile "people.txt"
      -- ... the rest
Re:Conrad Barski's Haskell Tutorial by frou_dh on Sunday July 14, 2013 @05:17PM (#6042287)
You're right, it was lack of indentation.
Re:Conrad Barski's Haskell Tutorial by sigzero on Sunday July 14, 2013 @05:02PM (#6042226)
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 by izietto on Monday July 15, 2013 @04:38AM (#6044352)
I'm unsure which regex package flavor to use... regex-base? regex-compat? regex-pcre? regex-???
Re:Conrad Barski's Haskell Tutorial by blaenk on Monday July 15, 2013 @07:16AM (#6044844)
This confused me when I was learning Haskell as well. The way I understand it is that regex-base defines a base-line interface -- such as the context-aware =~ function -- that all of the other packages implement, which is why they're known as 'backends' (e.g. regex-tdfa, regex-pcre, etc.).

In newer versions of GHC (> 6.6), the backends re-export this interface so that you just need to import the backend. regex-tdfa is the backend that I've used myself, mainly because I saw it used in other packages (Hakyll).

http://www.haskell.org/haskellwiki/Regular_expressions#regex...

Re:Conrad Barski's Haskell Tutorial by lelf on Monday July 15, 2013 @06:31AM (#6044713)
Text.Regex is provided by regex-comp. (Better install haskell platform).
Re:Conrad Barski's Haskell Tutorial by monokrome on Sunday July 14, 2013 @08:39PM (#6042963)
This website was written on a planet where 244 lines of Haskell is less than 100 lines of Haskell.
Re:Conrad Barski's Haskell Tutorial by drcode on Sunday July 14, 2013 @09:15PM (#6043086)
That's why there's a footnote on the front page:

[1] - Lines of active code only, not counting optional function signatures. Intermediate debug output lines excluded. May cause eye irritation if viewed for prolonged periods of time. Speak to your physician to find out if this tutorial is the best treatment option for you.