1. OCaml - what you gain

Thomas Leonard was working on rewriting 0install with OCaml. He previously wrote about how going from Python to Ocaml, he lost surprisingly little. The port is now complete, and he is back to tell us what you gain from OCaml. Good read; might motivate you to give OCaml a shot.

Among other things, he mentions OCaml’s “polymorphic variants”. It is a lovely feature, which once you look at, you may miss in every other language.

Thomas’ blog has many other gems - tips for OCaml, looking back at bugs he faced and whether they could have been prevented, overview of OCaml async libraries etc. Read it!

2. Marvel comics API

Marvel comics has an API! It gives you access to “data about Marvel’s vast library of comics — from what’s coming up, to 70 years ago”. Sounds exciting, right? Sign up, and play around.

3. Parametricity; Types Are Documentation

Chris Ford made an interesting statement on twitter last week - “I now realise that Orwell’s ‘Ignorance is strength’ becomes Philip Wadler’s ‘Theorems for free’ when applied to types”. It reminded me of these recent Tony Morris slides on the subject. The slides have many good examples that illustrate how parametricity can help you reason about code better.

4. Coursera’s success story with Scala, Play, and Akka

Coursera was built in PHP. As they reached a customer base of 6+ million and 500+ courses, they realized it wouldn’t work for them any more. They evaluated Python and Scala for stacks to switch to, and decided to go with the latter. As per the report, the choices have worked out very well for them. They were able to leverage Play and Akka to handle a high amount of traffic that the site receives. They also seem happy with the IDE and build tool situation of Scala ecosystem.

5. Implementing, Abstracting and Benchmarking Lightweight Threads on the JVM

Quasar implements light-weight threads on JVM, using bytecode instrumentation strategies, similar to what Kilim does. Scala Async and Clojure core.async provide a similar functionality. The article says, “Those employ a similar instrumentation scheme, but perform it at the language level, using macros, rather than at the JVM bytecode level like Quasar. While this allows Clojure to support core.async on non-JVM platforms (like JavaScript), the approach has two limitations: 1) it is only supported by a single language and can’t interoperate with other JVM languages, and 2) because it uses macros, the suspendable constructs are limited to the scope of a single code block, i.e. a function running in a suspendable block cannot call another blocking function; all blocking must be performed at the topmost function. It’s because of the second limitation that these constructs aren’t true lightweight threads, as threads must be able to block at a any call-stack depth.”

6. Data.Pattern, first-class patterns in Haskell

I absolutely love pattern matching. After using it for years, I still remain surprised by how easy it makes it to reason about code, how it aids readability, how concise it can make your code, and the way it can help you prevent subtle bugs.

One thing that leaves much to be desired however is the way pattern matching is implemented in most languages. It’s all at the language level. It doesn’t blend too well with the world of functions. The extensibility is fairly limited, and often needs additional bells and whistles like Scala’s “extractors” or Wadler’s “views”.

All of these problems could be alleviated if “patterns” and “clauses” are made first-class values. (Yes, first-class all the things!) Reiner Pope and Brent Yorgey’s Data.Pattern does exactly that. Take a look at Data.Pattern.Base and Data.Pattern.Common to see how beautifully it achieves this goal. IMO, after Control.Lens, this is the most amazing Haskell library ever.

7. First-class patterns in Newspeak

Newspeak is a dynamically typed, object oriented language, in tradition of Smalltalk. This very detailed paper presents first-class patterns for Newspeak. You’ll notice that it features many things from the Haskell implementation, and then some. The two being very different languages however, the implementation strategies differ. Bindings, in particular, are done very differently.

8. SkillsMatter interviews Chris Marshall

Chris Marshall is a known name in Scala circles, largely due to his contribution on StackOverflow. Here’s his recent interview with SkillsMatter.

I love the advice he gives regarding the importance of logging. It resonates well with my own experiences and views on the subject.

9. Saying Goodbye to Python

Don’t mistake the title! The post is not about some guy having found a new, better language, and leaving Python for it. It’s about Ian Bicking’s journey over past few years. He did a lot of great work in Python ecosystem (virtualenv and pip come to mind), and is now working with Javascript at Mozilla. Read his blog for more.

10. What is the type of derivative operator

This nice little post illustrates how typing discipline can be helpful in mathematics. I guess implementing a mathematics library in a dependently typed language may give a good taste of the kind of impact this may have.

11. Will a nicotine patch make you smarter?

The summary is, there have been a number of studies showing nicotine patches are safe to consume and can enhance cognitive functions in many ways: alertness, attention, memory, psychomotor speed etc. For some godforsaken reason, however, most neuroscientists still wouldn’t recommend its use. Probably they want more studies to assure its safety. But do you? ;-) And hey, you didn’t hear it from me.

Nicotine patches

Until next time!