Skip to main content

2 posts tagged with "haskell"

View All Tags

(Un)ordinary type-fu in Haskell

· 7 min read

I'm progressing with my learning of Haskell. After grasping basic concepts time has come to face more challenging stuff.

There are several "patterns" on the intermediate level and all make heavy use of types. The tennets are to reduce typing and making more generalized abstractions. They come at cost of upfront learning time and are hard to grasp really.

This time I tackled 2 topics: structural pattern and then generics. I managed to combine these two in one post, so I will share it today.

Wring simple parser with Megaparsec in Haskell

· 11 min read

There goes around opinion that pure functional languages are rock solid and well suited for critical systems. For example Facebook uses it in anti-spam filters, serval financial companies for derivative modelling and there is also some documented usage in compilers.

I tiptoed in Haskell long time ago, but didn't really get it. This time, my particular usecase was that I wanted to have parser for toy language with minimal effort. Parser combinators like Parsec or Megaparsec are known for purely declarative approach to modelling grammars.

After 2 weeks of playing with the language I must say that there is something strangely addictive in writing pure functional code. Reading it is hard, writing it even harder, but when it starts to work there is a lot of satisfaction. I don't know maybe I wasn't feeling confident about it before, but I finally started to like it.