-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Workaround for exception-throwing canonicalizePath in old directory #104
Workaround for exception-throwing canonicalizePath in old directory #104
Conversation
@@ -37,6 +44,14 @@ eventsFromFile = go [] | |||
|
|||
irrelevantEvents = [EventStreamStart, EventDocumentStart, EventDocumentEnd, EventStreamEnd] | |||
|
|||
#if !MIN_VERSION_directory(1, 2, 3) | |||
catchNotFound = handleJust |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bikeshedding: I would call this handleNotFound
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 that would be slightly nicer.
LGTM |
@@ -37,6 +44,14 @@ eventsFromFile = go [] | |||
|
|||
irrelevantEvents = [EventStreamStart, EventDocumentStart, EventDocumentEnd, EventStreamEnd] | |||
|
|||
#if !MIN_VERSION_directory(1, 2, 3) | |||
catchNotFound = handleJust |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 that would be slightly nicer.
@@ -1,6 +1,13 @@ | |||
{-# LANGUAGE CPP #-} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you give this a patch version bump and include a note in the ChangeLog
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I think I addressed everything.
@@ -37,6 +44,14 @@ eventsFromFile = go [] | |||
|
|||
irrelevantEvents = [EventStreamStart, EventDocumentStart, EventDocumentEnd, EventStreamEnd] | |||
|
|||
#if !MIN_VERSION_directory(1, 2, 3) | |||
catchNotFound = handleJust | |||
(\e -> guard (isDoesNotExistError e) >> guard (ioeGetLocation e == "canonicalizePath") >> ioeGetFileName e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not at all important, but IMO do notation would be slightly more legible here.
See: haskell/directory#44 (comment) This makes the exception for nonexistent yaml files the same regardless of which version of the directory package is used.
Thanks! |
See: haskell/directory#44 (comment)
This makes the exception for nonexistent yaml files the same regardless of
which version of the directory package is used.