Blogs

A few frustrations with Python's type annotation system

I have on and off again tried to use mypy to type check my python code, but some shortcomings of Python's type annotation system really get in the way. This came now because I needed to write code involving trees that had to change the types of values stored on the nodes. This highlighted a few serious shortcomings for anyone that is accostumed to use stronger type systems. The ugly syntax for function types is annoying but there are worse problems Yes, writing Callable[[Callable[[A], B], F[A]], F[B]] instead of (a -> b) -> f a -> f b as in Haskell or (A => B, F[A]) => F[B] (or maybe the uncurried (A => B) => (F[A] => F[B]) version) as in Scala is really annoying.

January 20, 2019

Einstein's racist diaries

This is a thought motivated by the current story about racist and xenophobic remarks found in Albert Einstein's personal diaries. People are morally flawed. There are no ethical heroes that escape this fact. Every role model of the past have some shitty secrets for us to uncover. If we could read the minds of any of our heroes we would find scandalous things that would shock us. With high probability, many contemporaneous humanitarians and humanistic heroes shared the shocking thoughts we abhor from Einstein's diaries.

June 12, 2018

Type safe records as an excuse to learn type level programming in Haskell

I've been recently trying to learn more advanced type-level constructs in Haskell and was very happy to find this amazing talk by Prof. Stephanie Weirich about Dependent Types in haskell. This talk helped me to understand deeper a few more recent concepts introduced by some of GHC's extensions and how to use them. In this post I want to focus a little bit in a simplified version of one of the data structures Prof.

February 12, 2018

Operational Semantics for Monads

Disclaimer: this is an old blog post from a very old wordpress blog and may contain inacuracies. I reproduced it as is for sentimental reasons. I may revisit this theme later. While randomly browsing around on Planet Haskell I've found a post on Heinrich Apfelmus’ blog about something called “operational semantics” for monads. Found it very iluminating. Basically it's a form to implement monads focusing not on defining the bind and return operators, but on what the monad is really supposed to do.

August 25, 2010

Stochastic Processes as Monad Transformers

Disclaimer: this is an old blog post from a very old wordpress blog and may contain inacuracies. I reproduced it as is for sentimental reasons. I may revisit this theme later. I have a difficulty to understand functional programming concepts that I can’t put to some very simple and natural use (natural for me, of course). I need to find the perfect simple example to implement to finally understand something. And I’m not a computer scientist, so things like parsers and compilers have very little appeal to me (probably because I don’t understand them…).

August 3, 2010