There is no Spoon
(Bending the Compiler)

Matej Kollár
mkollar+fpb0@redhat.com

February 2015

Problem

Text file

Pros

Cons

Database

Pros

Cons

Undecided

Tough choice

Third option

Compiler

Compilers are good for… compiling.

compiler :: Source -> Input -> Output -- Oversimplified...
compiler :: Source -> Maybe (Input -> Output) -- Still oversimplified

…but what if there is more to them than that?

There is no compiler!

type Source = Text
compiler :: Source -> Error (Input -> Output) -- Still oversimplified
magic = fmap (const ()) . compiler :: Text -> Error ()
data Tag = Fiction | Programming | FunctionalProgramming
data Status = Done | Reading Rational | Todo
data Language = EN | SK | CZ
data Format = TextBook | AudioBook
data Book = Book
    { name :: String
    , authors :: [String]
    , progress :: Status
    , notes :: String
    , language :: Language
    , format :: Format
    , tags :: [Tag]
    }

Pros

Cons

Notes

Of course, you can do very similar things with other compilers as well, though there is something to Haskell that makes it well suited for this.

P.S.: For extra awesomeness do not forget to throw in some version control.

Questions?

Thank you for your attention.