Abstract FilePath Proposal

Michael Snoyman michael at snoyman.com
Mon Jun 29 09:22:49 UTC 2015


On Mon, Jun 29, 2015 at 12:07 PM Erik Hesselink <hesselink at gmail.com> wrote:

> On Mon, Jun 29, 2015 at 10:46 AM, Michael Snoyman <michael at snoyman.com>
> wrote:
> > Regarding underspecified: I think that's appropriate at this phase. The
> main
> > proposal is: maybe FilePath an abstract type. It will take multiple GHC
> > releases before we switch over fully, with plenty of time to hash out
> > details of how the filepath package should work, and the opportunity to
> > experiment with different wrappers around a core abstract type.
>
> But changing the semantics of an established newtype is very tricky
> business, since the resulting breakage won't be indicated by the
> types!
>
>
My suggestion isn't to roll out one breaking change and then another silent
semantics change later. Rather, my point is: getting FilePath to be an
abstract type is the meat of the proposal, and what we need to agree on.
Working out the exact semantics of how the filepath package interacts with
that is important, but not urgent. Let's get to an agreement that an
abstract type is an improvement, and then we can figure out exactly how it
should behave. After all, we'll have about 2 years to figure that out.


> > Having used an alternate FilePath type for a while (via
> system-filepath), I
> > can say that it doesn't give the same benefit of just fixing the central
> > FilePath type. Having to convert between types all over the place is
> > tedious, defeats a lot of the performance benefits we're going for, and
> > hurts type safety.
>
> Why would you have to convert 'all over the place'? If the alternative
> library also provides the basic IO functions, the only places you'd
> have to convert are interfaces with other libraries, and things from
> e.g. config file, both of which don't happen a lot.
>
>
By having two different types, we know that not everyone will convert over.
In fact, the very argument for having two types is so that not everyone
will need to convert. Especially if Prelude continues to export the current
`type FilePath = [Char]`, it will be difficult to get all libraries to use
the new type.


> > As someone who typically is very much opposed to breaking changes in core
> > libraries: I think this one is well worth it.
>
> Do you have any insight in the amount of breakage this will cause? I
> have a gut feeling that it's a lot more than any of the previous
> changes we've had, and those have already caused a lot of grumbling.
> But the only way to be sure is to run the builds on hackage (or
> stackage, but that's a smaller sample size).
>
>
I agree, this is going to be a big one. It does not lend itself to elegant
migrations like FTP did, for instance. But the scope of the current problem
is also large, which is why I believe this breakage is warranted. Doing it
gradually with a deprecation plan will hopefully make it possible for us to
make it as easy as possible.


> Erik
>
> > On Mon, Jun 29, 2015 at 11:39 AM Erik Hesselink <hesselink at gmail.com>
> wrote:
> >>
> >> I think this proposal is currently underspecified. For example, it's
> >> not clear to me what the semantics of a FilePath are. I have the
> >> feeling that `toFilePah` should return a Maybe, for example, but it's
> >> hard to say without knowing what it's converting to, exactly.
> >>
> >> I also worry about the immense breakage this will cause. This is not
> >> just an issue of causing a lot of work for maintainers, but also of
> >> lots of unmaintained libraries, printed code etc breaking. I feel that
> >> there is not enough gain in this proposal relative to the amount of
> >> breakage.
> >>
> >> Has any thought been given to introduce new modules for this type, and
> >> leave the old ones in place?
> >>
> >> Erik
> >>
> >> On Fri, Jun 26, 2015 at 6:08 PM, Herbert Valerio Riedel <hvr at gnu.org>
> >> wrote:
> >> > -----BEGIN PGP SIGNED MESSAGE-----
> >> > Hash: SHA1
> >> >
> >> > Hello *,
> >> >
> >> > What?
> >> > =====
> >> >
> >> > We (see From: & CC: headers) propose, plain and simple, to turn the
> >> > currently defined type-synonym
> >> >
> >> >   type FilePath = String
> >> >
> >> > into an abstract/opaque data type instead.
> >> >
> >> > Why/How/When?
> >> > =============
> >> >
> >> > For details (including motivation and a suggested transition scheme)
> >> > please consult
> >> >
> >> >   https://ghc.haskell.org/trac/ghc/wiki/Proposal/AbstractFilePath
> >> >
> >> >
> >> >
> >> > Suggested discussion period: 4 weeks
> >> > -----BEGIN PGP SIGNATURE-----
> >> > Version: GnuPG v1
> >> >
> >> > iQIcBAEBAgAGBQJVjXkZAAoJELo8uj/+IrV0WXUP/0romoKazwLbQpaMAKgCNZon
> >> > BsY8Di44w6rkbdBXoky0xZooII8LJJyQfexH0BLRYEVLZFy0+LB8XzpPt8Ekg526
> >> > YlY4x0qFm9oiJbJDMqHUnb6z6Lr2KxzBcV37drTPbltUA+HB49DUVkkPbvHimpL2
> >> > 28SIyhAr4fN6fLpGcFAkv6Rcs0mkvnTp7vsC0HNyshmGi6qQ+C+eB4mklQzWOPcn
> >> > koHZ2wtI8AJmyTdHKcXKAIFM0r+xl4MJ5445IvDjvIuGXZCzybXMw9Ss/4wSG3VN
> >> > qSIJVEDGZXrBCc12fPxPEB0Bqx9MIVytjplXKIo8rFrk93h3at9t9kDM26z+9PZ5
> >> > KYnEdjRKF4KL4j+3xqJDOEJT15GVRbGRRzb9A8xH0YIQ0S3Q3pt1PAfla1Hss75+
> >> > NRQgfowZYryL9dfCkAj2XNfdQ+pUk25N3bNig11se+zjk2JO77QRM0u3GOYZ9+CU
> >> > tSlwhtIMF32xnjgQyWE5yBBiEg3/Y+S+809tVaPseUEzkQJXMGq5TFxBrN6bj1Vm
> >> > awr6QghThKjeoRwky5bmFn/gept/lbYN6VV5B6gNznGP5xgFrmvVtmjbQJBRMYCv
> >> > aEUnrYqxkkbIddJjD5gl771/LWH4M2F1yBgJjfiZw2paEVAXKxEr327LsbOQaPdb
> >> > HjIPRrJbVK9AABo4AZ/Y
> >> > =lg0o
> >> > -----END PGP SIGNATURE-----
> >> > _______________________________________________
> >> > ghc-devs mailing list
> >> > ghc-devs at haskell.org
> >> > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
> >> _______________________________________________
> >> ghc-devs mailing list
> >> ghc-devs at haskell.org
> >> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20150629/fea5a251/attachment-0001.html>


More information about the ghc-devs mailing list