Skip to content
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

Merged
merged 1 commit into from
Jan 25, 2017
Merged

Workaround for exception-throwing canonicalizePath in old directory #104

merged 1 commit into from
Jan 25, 2017

Conversation

liskin
Copy link
Contributor

@liskin liskin commented Jan 24, 2017

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.

@@ -37,6 +44,14 @@ eventsFromFile = go []

irrelevantEvents = [EventStreamStart, EventDocumentStart, EventDocumentEnd, EventStreamEnd]

#if !MIN_VERSION_directory(1, 2, 3)
catchNotFound = handleJust
Copy link
Collaborator

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

Copy link
Owner

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.

@sol
Copy link
Collaborator

sol commented Jan 25, 2017

LGTM

@@ -37,6 +44,14 @@ eventsFromFile = go []

irrelevantEvents = [EventStreamStart, EventDocumentStart, EventDocumentEnd, EventStreamEnd]

#if !MIN_VERSION_directory(1, 2, 3)
catchNotFound = handleJust
Copy link
Owner

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 #-}
Copy link
Owner

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?

Copy link
Contributor Author

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)
Copy link
Owner

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.
@snoyberg snoyberg merged commit 02b2d5d into snoyberg:master Jan 25, 2017
@snoyberg
Copy link
Owner

Thanks!

@liskin liskin deleted the directory-canonicalizePath-exception branch March 4, 2017 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants