Skip to content

Instantly share code, notes, and snippets.

@hellertime
Created November 2, 2010 02:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hellertime/659175 to your computer and use it in GitHub Desktop.
Save hellertime/659175 to your computer and use it in GitHub Desktop.
Control.Exception.handle is ambiguous in its type, you must provide a type signature for it to type-check.
> import Control.Exception ( handle, IOException )
here is a specialize handle which deals with IOExceptions
> handleIO :: (IOException -> IO a) -> IO a -> IO a
> handleIO = handle
Without this added signature you will get type-check errors like this:
Ambiguous type variable `e' in the constraint:
`GHC.Exception.Exception e'
arising from a use of `handle'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment