This code is very fragile; a more robust solution would be nice.
Finding a suitable abstraction that works for a variety of protocols is difficult. Maintaining several protocols also probably isn't worth the effort. By using a single protocol we also keep the front-ends completely independent of the server. (Otherwise some front-ends may end up broken with various versions of the server because some protocol-specific patch didn't make it into the release.) JSON is a simple and very widely supported protocol. It doesn't fit too well with Haskell's or Emacs' type system (e.g., ambiguous encodings) but at least this Hydra has only one head. ATM, the Emacs front-end is mostly broken because the commands are often not encoded correctly, but the server itself should be fine.
This is needed to efficiently implement getLine on top of the chunk-based socket. Possibly network-bytestring should implement this, so we don't have two levels of buffer management.
In particular, server/Scion/*.hs matches nothing, so make tries to find a rule for it. Fixed by being more specific in the dependencies.