Open cloudyluna opened 6 months ago
The main issue I see is that OsPath
doesn't have an IsString
instance. Other than that I'd be fine with migrating to it
The main issue I see is that
OsPath
doesn't have anIsString
instance. Other than that I'd be fine with migrating to it
It doesn't have one, because we can't write a sound instance.
maybe switch to https://hackage.haskell.org/package/path ?
It has the same issue and it's even worse, because you can have 4 different types:
Path Rel Dir
Path Abs Dir
Path Rel File
Path Abs File
Which one is it gonna be when you write "foo"
? You could distinguish via trailing slash, but that's fairly finicky. I guess for turtle
that could make sense... so just write an orphan instance.
Wrt OsPath
the issue is more nuanced (note that path
now also has an OsPath
variant: https://hackage.haskell.org/package/path-0.9.6/docs/OsPath.html), because you have to assume an encoding. Again, doing that generically for IsString is just incredibly bad API, so we won't do that. For this library, it can make sense to assume utf-8/16. So again: an orphan instance seems fine. os-string/filepath won't add one, so you don't have to worry about that.
I dont know why we need IsString at all
One reason why I insist on an IsString
instance is that turtle
is supposed to be ergonomic to use from within a ghci
REPL
I think IsString is possible
Path Rel Dir - ./foo/ Path Abs Dir - /foo/ Path Rel File - ./foo.txt Path Abs File - /foo.txt
I think IsString is possible
Path Rel Dir - ./foo/ Path Abs Dir - /foo/ Path Rel File - ./foo.txt Path Abs File - /foo.txt
You're aware parsing can fail, right? E.g. /foo/../bar
is not permitted by the path library.
Since IsString can't express failure, what are you going to do?
Right, I didnt think about it @Gabriella439 maybe better use TemplateHaskell?
Hello! Let me start by saying thanks for this great library. I learned a lot by using it so far as a Haskell beginner. :smiley:
Anyways, I noticed that
filepath
package recommends to use OSPath instead of FilePath.Since I believe that
turtle
is largely being used as a shell scripting alternative (including in cross-platform manner) and which means, may involve a lot of file and directory manipulations, I reckon it's probably better in long term to adopt OSPath?I was inspired to open this issue after reading this post on Discourse.
Thanks!