Made ghc -e have a nonzero exit code upon failure (Trac #7962 )

Signed-off-by: Austin Seipp <austin@well-typed.com>
Refactored by Simon Marlow's suggestion

Signed-off-by: Austin Seipp <austin@well-typed.com>
Fix compiler warnings due to integer size mismatch

Signed-off-by: Austin Seipp <austin@well-typed.com>