Abstract FilePath Proposal

Herbert Valerio Riedel hvr at gnu.org
Sat Jun 27 07:36:22 UTC 2015


On 2015-06-26 at 18:22:16 +0200, Henning Thielemann wrote:
[...]
>>>  type FilePath = String
>>>
>>> into an abstract/opaque data type instead.
>>
>> Has someone else tried the pathtype package?
>>   http://hackage.haskell.org/package/pathtype
>
> Hm, your last point "Decisions assumed by this Proposal" seems to
> mean, that you want to leave out more specialised types from this
> proposal. That is, dir/file distinction might be defined on top of the
> new FilePath type.

Yes, because the proposal is meant to only make the smallest incremental
change needed (i.e. change FilePath datatype, provide conversion
functions) to to achieve the primary goals (reduce space/time overhead &
make it a distinct type from String) in a way suitable for a future
Haskell Report, while trying to stay close enough that you can still
write code that works with both the H2010 and a AFPP definition of
`FilePath`

Trying to redesign the FilePath type to also include dir/file
distinction seemed too daunting, as there's quite some additional
design-space area to explore (do drive-letters deserve a separate type?
do we use DataKinds? What invariants can/shall be represented at the
type-level? what errors are caught at the type-level, which are caught
at runtime? etc...), parts of which may require type-system extensions,
while just having a KISS-style opaque FilePath evades this.



More information about the Libraries mailing list