Fix formats, redundant imports, shadowing, etc

This commit makes hlint and ghc -Wall -Werror rather more happy. Still
quite a bit to do w.r.t. to code structure though.
Merge pull request #5 from anchor/wip-cleanup

Fix formats, redundant imports, shadowing, etc