-
Notifications
You must be signed in to change notification settings - Fork 16
Some tweaks and updates for the next release #18
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
Conversation
@@ -505,20 +527,32 @@ module Data.Path.Pathy | |||
instance eqPath :: Eq (Path a b s) where | |||
eq p1 p2 = canonicalize p1 `identicalPath` canonicalize p2 | |||
|
|||
instance showFileName :: Show FileName where | |||
show (FileName name) = "FileName " <> show name | |||
instance ordPath :: Ord (Path a b s) where |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How could this be used? "./" < "/" < "../foo" < "/foo/" < "/foo"
😕
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's so you can use paths in dictionaries and the like, the ordering isn't meaningful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah! I see. I don't know if it makes sense but why not something like this?
instance ordPath :: Ord (Path a b s) where
compare p1 p2 = compare (unsafePrintPath p1) (unsafePrintPath p2)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm allergic to strings 😆. In all seriousness, I think that would be less efficient, as the escaper runs for every path segment when you convert it to a string vs just checking the structure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok 😄
830bda3
to
1e872ed
Compare
Ok, this is ready to review now. As well as fixing the linked issues and adding some new basic instances there's a new function: -- | Marks an absolute path as sandboxed without sandboxing to a particular
-- | location.
sandboxAbs :: forall b. Path Abs b Unsandboxed -> Path Abs b Sandboxed as we end up using a coercion to that effect all the time. I did consider making it Also updated the formatting to be more consistent with how we do it everywhere else. Also fixed some links in the docs to a non-existant examples file. |
@garyb That function is not safe and defeats the point of sandboxing. You can change the signature to return |
@jdegoes you mean the version of If so, yeah, that's why I said it was questionable. I was going to handle |
An absolute path may contain relative entries. Meaning that the signature of |
Ah ok, I see now. |
I've removed the offending I think fixing #5 should fix slamdata/slamdata#928 since that seems to be arising due to |
We'll have to release this as v2.0.0 as it didn't make the v1.0.0 cut - making the left/right stuff consistent means the API has a breaking change. Possibly changing things to escape properly could be considered a breaking change too, given the behaviour above with |
Any objections to me merging this as it is @jdegoes? |
Looks good. 👍 |
Resolves #14, will resolve #5.
Wanted to get a few things in before we tag a new version 😄