My Programming Escapades
Andraz Bajt
Approaches to designing a Haskell API
Recently I've been thinking about the design of programming interfaces, especially in Haskell. But don't let the title misguide you; this is not supposed to be a tutorial or a guide but simply an showcase of different styles. Feel free to tell me I'm wrong or missed something. The problem Let's say we are writing an interface to RESTful web service. Our goal is to create type safe functions and descriptive models but all in all easy to use.
2014-10-05
Static linking with GHC on ArchLinux
There are many reasons why to prefer dynamic linking to static but I'll not go through them. Sometimes you just want static linking, period. In my case it was to show that Go‘s static executables without dependencies are not something special and other languages can do it as good as well - Haskell included. My compiler of choice is GHC and I'm running ArchLinux. More on why this is important later.
2014-05-03
Coroutines for free
Motivation My first run-in with coroutines was with Python's generators. def ints(): i = 0 while True: yield i i += 1 This is a function that never returns. Instead it runs in an infinite loop over all natural numbers. But it yields every number. This means it actually stops and “returns” the number to the caller but is available for more execution. Kind-of like implementing an Iterator but the control flow is reversed.
2014-04-14
Practical Future[Option[A]] in Scala
Motivation In real world concurrent code you often come across the Future[Option[A]] type(where A is usually some concrete type). And then you need to compose these things. This is not straightforward in Scala. If you've done some Haskell just import scalaz._ and you can skip the rest of this article. Scalaz library defines a monad typeclass(and many others) that formally specifies what it means to be a monad(not “has a flatMap-ish thingy”).
2014-03-07
Comparing Haskell Web Frameworks
Intro Lately I got sucked into Haskell. When I first saw it it looked like it might be a bit impractical for real-life projects but this prejudice faded away slowly. Now I'm at the point where I have an idea for a web application and I'd like to do it in Haskell. After a quick search I found many frameworks and libraries that I might use. So I decided to do some exploration and implement a bunch of stuff with different technologies.
2014-02-23
Product and sum types (Go and Haskell)
Let's take a look at Go-language functions. They let you return more than one result. Like in func foo(n int) (int, int) { return n+1, n+2 } This function foo returns two numbers. But does it really? Pairs(and tuples in general) aren't a first class citizen in Go. Yes you can return them from function and you can even return a result of a function that returns the same signature as you but then you must immediately bind each result to separate variable.
2014-02-17
Hakyll
Hello there. I think I'm gonna resurrect this blog as I feel like writing again. I kinda have a general dislike for PHP and don't like Wordpress. I tried mucking about with Github Pages, but I'm not a fan of Jekyll either. And then I forgot about this. Haskell A few weeks ago I rediscovered Haskell. I tried learning it once before but gave up. And insisted in Scala. This time I believe I got past the hardest part of the learning curve.
2014-01-08
Virtual machine in C++
This is not a tutorial. This post is a flashback I had today. It might be a bit fiction as my memory about events tends to be fuzzy at times. But I promise it at least resembles the real story. I was in elementary school and just found out about programming and was learning about c++. After reading “C++ na kolenih” by Goran Bervar I was empowered by knowledge and tried to do all sorts of projects.
2013-10-18
Setting up for better Scala development on Android
I did a tutorial how to set up everything using IntelliJ a while ago. I still think IntelliJ IDEA is awesome and you should use it(it has a free and open version) but I've found a better way. No more clicking around in wizards…it's config file time. Relax - it's quite simple. I recommend installing the Typesafe-stack. It gives you the two tools listed below in nice packaged form with updates.
2013-09-04
750 words
This week I felt the impulse to express myself multiple times. I felt like writing. Being a bit sentimental I opened up a notepad I got from my girlfriend as a birthday present and began a brain dump. A stream of consciousness. But my handwriting is painfully slow. This means I had time to do reformatting and rewording in my mind. Sot this was definitely not a brain dump. I wasn't expressing my thoughts directly but rather doing some writing - I don't know how to put this subtle(but important) difference better.
2013-01-27