Use Safe Haskell

Signed-off-by: Nicola Squartini <tensor5@gmail.com>
Specify imported entities

Signed-off-by: Nicola Squartini <tensor5@gmail.com>