Skip to content

Conversation

@hasufell
Copy link
Owner

@hasufell hasufell commented Jun 29, 2022

@Bodigrim

Rendered markdown: https://github.com/hasufell/hasufell.github.io/blob/AFPP/posts/2022-06-29-fixing-haskell-filepaths.md

TODO:

  • fix API links after release
  • explain better that interpertation and conversion is still possible

Copy link

@Bodigrim Bodigrim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! I left some minor remarks.

I'm pleased to announce that the Haskell type `type FilePath = String`
has a successor, which was first discussed many years ago as the [Abstract FilePath proposal (AFPP)](https://gitlab.haskell.org/ghc/ghc/-/wikis/proposal/abstract-file-path).

The new type shipped with the [filepath-1.4.99.0](https://hackage.haskell.org/package/filepath-1.4.99.0/candidate) package is (simplified, omitting some type aliases):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the rationale to distinguish OsString and type OsPath = OsString? Could we just define OsPath as below?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some parts of the filepath API deal with things that are not really filepaths, e.g. https://hackage.haskell.org/package/filepath-1.4.2.2/docs/System-FilePath.html#v:splitSearchPath

splitSearchPath :: String -> [FilePath]

So we want to maintain that light distinction.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dunno, if it's worth it. Type synonyms may cause confusing error messages.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've sent this for discussion to the CLC long ago, but never got an answer.

https://groups.google.com/g/haskell-core-libraries/c/WzapcSvvfQM/m/P4xgPsy8CwAJ

After some discussions with users on IRC i decided to keep the type synonym.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd certainly prefer no type synonyms, but up to you. Might be worth to elaborate on this decision in the blog post.


So, you can just:

1. update your dependencies lower bounds to the minimum version that supports `OsPath`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good place to give some examples, e. g., filepath >= 1.4.99, unix >= 2.8, Win32 >= 2.14 or whatever.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, need to wait for releases to know which versions exactly.

@hasufell hasufell merged commit 2f3c494 into master Jul 15, 2022
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.

4 participants