Haskell tutorial for C programmers
11–20 of 56 posts
Re: Haskell tutorial for C programmers
#12Great! A Haskell tutorial for JS or PHP programmers would be awesome.
Re: Haskell tutorial for C programmers
#13Thanks for posting this.
EDIT: typos
Re: Haskell tutorial for C programmers
#14Earlier quoted context omitted.
How do you express the Ordinality constraint in C++?
Multiple inheritance from a purely virtual class. In Java, they're called interfaces; Comparable is the analogue to Ord. 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…
Re: Haskell tutorial for C programmers
#15Great! A Haskell tutorial for JS or PHP programmers would be awesome.
Re: Haskell tutorial for C programmers
#16The current intro course looks really nice: http://www.seas.upenn.edu/~cis194/lectures.html
Re: Haskell tutorial for C programmers
#17Earlier quoted context omitted.
Multiple inheritance from a purely virtual class. In Java, they're called interfaces; Comparable is the analogue to Ord. 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…
Yeah, though you will want to be the owner of either the type class or the type itself. Instances which are neither are called orphan instances and they are generally frowned upon. Luckily, it's trivial to create a newtype wrapper which gives you a whole new set of hooks for writing instances of a type.
Re: Haskell tutorial for C programmers
#18Chris 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
#19Earlier quoted context omitted.
Multiple inheritance from a purely virtual class. In Java, they're called interfaces; Comparable is the analogue to Ord. 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…
Yeah, though you will want to be the owner of either the type class or the type itself. Instances which are neither are called orphan instances and they are generally frowned upon. Luckily, it's trivial to create a newtype wrapper which gives you a whole new set of hooks for writing instances of a type.
Re: Haskell tutorial for C programmers
#20>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.