[Haskell-cafe] How to build a horse with Haskell (comic extension)

J Ho jho.xray at gmail.com
Thu Oct 31 13:34:45 UTC 2019


There was this comics “how to build a horse” with different languages. I’ve always felt Haskell was missing. Found this on Quora - https://www.quora.com/How-do-you-build-a-horse-with-the-Haskell-programming-language/answer/Anton-Antich

How to build a horse with Haskell.

Building just a horse is boring, so you generalize it to a spherical horse in vacuum that can represent other animals sufficiently well.

It takes 5 years, 43 research papers and only 3 people in the world can ride it (including SPJ).

You build a horse. It’s fast, but lazy.

You build a beautiful, friendly horse. You call it Monadic Quadro-pedo-functorial Transporter. People are afraid to touch it and it dies of loneliness.

You build something that is Maybe a horse.

All your horses come in boxes with bottom.

You were a java programmer so you build a horse factory. It gives you Either a horse or a terrible runtime abomination.

You build an existential horse. You can’t see or access its hoofs, tail, back, anything. It just sort of sits there and stares at you.

You build an infinitely large horse. You can still ride it, because it’s lazy (it just sits there, just like the existential, and you crawl on its back slowly).

You tease Java programmers who can’t possibly ride infinite horses.

You build an even faster horse that is unboxed. You notice it is eager.

You build a higher-kinded Horsificator. It turns anything else into horses.

data Horsificator a = Horse a | Abomination
You want to ride a rhino, but they normally would kill you.
You build a horse typeclass. You make rhinos an instance of Horse.

Polymorphic domestication!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20191031/3cafadf8/attachment.html>


More information about the Haskell-Cafe mailing list