Haskell tutorial for C programmers
haskell.org
haskell.org
Most 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?...
Oh cool, you can do everything, right up to something useful. At which point you should use this library for side effects, no wait, this new library, oh wait, have you tried this new feature that's only in the latest GHCi and w/ the right Data import? ... eh, maybe I'll pass.
Still doesn't stop me from playing around now and thien. Right now the resources here: http://www.seas.upenn.edu/~cis194/
and the new book Beginning Haskell, seem to be alright.
The tutorials are all out there, but one is going to have to have a pretty solid grasp on Haskell before one can understand them, just like with any other language.
Where? The only half appealing type safe query DSL that I've found for Haskell is Esqueleto, and that features a blank github readme[1] o_O
[1]https://www.fpcomplete.com/school/to-infinity-and-beyond/pic...
Edit: Also, esqueleto has a pretty okay looking hackage page[2], but I've never used esqueleto, so I don't really know.
Acid-state is a different beast entirely, seems to be similar to Clojure's Datomic.
That leaves us with Esqueleto for real world type safe database access (with no SQL Server or Oracle support).
I want to jump ship from Scala to Haskell but there are some gaps to be filled yet before leaving the batteries included Java ecosystem.
One explanation of course might be that a lot of the crowd looking into this are coming from a computer-science background where they are more enthusiastic about the basics. And to them, the fact that (after a lot of coding chores, writing up libraries) it eventually will make sql-injection harder, or parallel handling of web-service faster will be seen just as a logical consequence not worth making a lot of fuzz about.
But for attracting a larger community one has to make the gains for the average programmer more visible.
The current intro course looks really nice: http://www.seas.upenn.edu/~cis194/lectures.html
For those without showdead on:
"I posted about the same comment as the parent hours ago. I don't know if anybody even sees my posts, never gotten a response, and my "karma" or something has always been 15. And posting and reading the forum is very slow. What gives?"
Looking through your comments, I don't see an obvious reason you were hellbanned.
But I guess if you can do that, you would also recognize the effects of a hellban on your account.
I'm trying to grasp how moderation and banning works around here, but it's difficult since neither the FAQ nor the posting guidelines have an explanation about it.
Thanks for posting this.
EDIT: typos
Don't expect to "pick up the language" in an evening :)
Haskell takes a few evenings at the very least!
For anyone who needs a refresher on DFA, Stanford's CS143 compilers class course materials are up on Coursera (https://www.coursera.org/course/compilers), and pretty helpful.
Er, you could define mergesort using templates in c++ and it would work pretty much the same.
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. mutableSort :: (MArray arr elem m, Ord elem, Ix ix) => arr ix elem -> m ()
This can work on mutable arrays in the IO, ST, or other mutable-array supporting monads. It also has a generalized index type (though newer array libraries threw that part away, so it's not considered a good idea anymore).Interfaces or pure virtual classes are not the same because they're closed.
The advantage that Haskell's typeclasses have over either Java or C++ is that the types aren't closed. I can define a new typeclass and tell the compiler that a type you defined is a member of that class at any point. In Java, if you don't define that your type is Comparable, there's nothing that I, as a consumer of your type, can do about it.
(A) Ability to instantiate old types with new classes
(B) Conditional instantiation: "Maybe a" is an instance of "Show" iff "a" is an instance of "Show"
(C) Can do return-type polymorphism, or polymorphism on any part of the signature
(D) Objects do not need to pay for the interface vtable pointer. Large array of some type-class instance can be much smaller than an array of an OOP interface subclass.
(E) When comparing two Ord instance values, there is only one Ord dictionary, rather than 2 to choose from. No false dilemma.
One type -> at most one instance for any class, in Haskell.
The error you get if you try to sort a vector with an unordered type is relatively easy to read:
main.cpp: In instantiation of 'void merge_sort(std::vector<_RealType>&) [with T = type]':
main.cpp:45:17: required from here
main.cpp:30:5: error: static assertion failed: Element type is not sortable
static_assert( concept::is_ord<T>(), "Element type is not sortable" );
^http://www.eblong.com/zarf/zweb/lists/
Bit dated, though :)