use export list instead of where clause

the where clause was becoming uncomfortably long.
withTestLock, a version for testing

I think the pragma will tell GHC to optimize the withLock and
withTestLock versions separately, but I don't know how to verify that
this is indeed the case.
distinguish uses of a socket as a lock

as opposed to uses of a socket as a socket, inside the implementation of
lock.
fix test suite

the codebase had evolved, causing the tests to stop compiling.