Haskell tutorial for C programmers
21–30 of 56 posts
Re: Haskell tutorial for C programmers
#22Chris Allen / coolsunglasses maintains a great gist of a learning path for haskell: https://gist.github.com/bitemyapp/8739525 The current intro course looks really nice: http://www.seas.upenn.edu/~cis194/lectures.html
Re: Haskell tutorial for C programmers
#23>What this means is that existing sort functions such as mergeSort and quickSort would need to be rewritten to sort values of the new type. In constrast, here is the type of mergeSort in Haskell mergeSort :: Ord a => [a] -> [a] Er, you could define mergesort using templates in c++ and it would work pretty much the same.
Yeah, I don't get why that's superior to something like std::sort : http://en.cppreference.com/w/cpp/algorithm/sort (or a similar approach however you like).
Ord a => [a] -> [a]
You therefore know that the implementation of the function can only make use of functions provided by Ord, and manipulation of the list structure. The function cannot inspect the values in the list except via comparison. This is an incredibly powerful guarantee. It's also really useful when you go to implement the function because this level of parametricity guarantees that there are only so many valid implementations and only a couple of them are even close to correct.Re: Haskell tutorial for C programmers
#24Just write a simple tutorial about a real world example, nowadays usually having something to do with the web, and especially point out how it's better than doing the same thing in ruby, php or even gasp java! We'll learn ourselves how you define lists and how magical they are in haskell...
And people who write compilers and parses all day long probably won't have a problem with the way haskell looks.
Re: Haskell tutorial for C programmers
#25Earlier quoted context omitted.
Yeah, I don't get why that's superior to something like std::sort : http://en.cppreference.com/w/cpp/algorithm/sort (or a similar approach however you like).
The difference is entirely in the types. A sort function in Haskell has type: Ord a => [a] -> [a] You therefore know that the implementation of the function can only make use of functions provided by Ord, and manipulation of the list structure. The function cannot inspect the values in the list except via comparison. This is an incredibly powerful guarantee. It's also really useful when you go to implement the functi…
Re: Haskell tutorial for C programmers
#26This is great, now I just need a similar tutorial but for LISP.
http://www.eblong.com/zarf/zweb/lists/
Bit dated, though :)
Re: Haskell tutorial for C programmers
#27Most tutorials and books are very enthusiastic in how they can detect that I try to zip two lists of different cardinality during compile time, or how they can lazily calculate the Fibbonacci sequence. And that's really nice and fine...
But nevertheless, I use C all of the time, and I learnt how to make use of a myriad of libraries, combine connections to a SQL database, embedd a webserver, talk to USB,... Must have been 20 years ago that I wrote code to calculate the Fibbonacci sequence.
So, where are tutorials that showcase all the wonderful "high-level" functionality that has already been written for Haskell, so that I, after reading through the text, will be thrilled how much work I can avoid, or how much security I can gain when switching over from my "almost bare-matel not-much-more-like-an-assembler C" to Haskell? Not in calculating the Fibunacci sequency, but in writing a backend for my web-app, or talk to a USB peripheral? Do 3D graphics?...
Re: Haskell tutorial for C programmers
#28Oh my, another tutorial. I've looked at many of them, trying to learn something from the Haskell way. And I think I get the fundamental advantages of the type systems, the lazy evaluation enabled by the languages purity, I think I can somehow make sense of the Monads even. I have the "learn you a haskell for good" on a pile of books where I have a glimpse from time to time. Most tutorials and books are very enthusias…
Re: Haskell tutorial for C programmers
#29Oh my, another tutorial. I've looked at many of them, trying to learn something from the Haskell way. And I think I get the fundamental advantages of the type systems, the lazy evaluation enabled by the languages purity, I think I can somehow make sense of the Monads even. I have the "learn you a haskell for good" on a pile of books where I have a glimpse from time to time. Most tutorials and books are very enthusias…
Re: Haskell tutorial for C programmers
#30Oh my, another tutorial. I've looked at many of them, trying to learn something from the Haskell way. And I think I get the fundamental advantages of the type systems, the lazy evaluation enabled by the languages purity, I think I can somehow make sense of the Monads even. I have the "learn you a haskell for good" on a pile of books where I have a glimpse from time to time. Most tutorials and books are very enthusias…