Roc version 0.1.0, eight years in the making (opens external site)
View full thread · View on Hacker News
To get push notifications on iPhone or iPad, add Hack and Chat to your Home Screen: tap Share → Add to Home Screen, then open the installed app and enable push in Settings.
View full thread · View on Hacker News
I'm not sure about Haskell and Erlang/Elixir since I haven't used them much, but aren't multimethods the Clojure solution for this?
Replies (1)
So you can, say, have a definition for when the value of n is 0, n is 1, etc.
This is a nice example in Haskell:
Basically it enables you to use recursion more elegantly because the pattern matching is folded into the function signature.Replies (2)
What Haskell is doing there is basically just a kind of syntactic sugar around a pattern match, which is (to a very rough approximation) basically a super-powerful switch. Like a switch, the compress function knows about all of the branches statically, even if at runtime it dynamically selects which branch to take based on the structure of its arguments. And the structure of its arguments is "closed": it knows at compile-time all the different forms they can take.
Haskell achieves dynamic dispatch through typeclasses, and it can do multiple dispatch with the MultiParamTypeClasses extension. With these a caller doesn't need to know about the implementation it's invoking, and it doesn't need to know in advance anything about the possible values of its arguments beyond that they have an implementation that can be used - typeclasses are open, you can always define new implementations without updating every caller that uses them.
Replies (1)
It's not just Haskell, though. Like I said, Erlang/Elixer also support this, and it enables writing some really elegant code.