Fix if-then-else inside do.
Fix cabal file, add test suite.