According to the FFI spec, this should have type IOErrorType -> String -> Maybe FilePath -> Maybe Handle -> IOError but System.IO.Error has the last two arguments in the other order. I think the spec is right, because that matches the order for annotateIOError.