Skip to content
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

Add the 'isRoot' predicate #67

Open
mrkkrp opened this issue Mar 2, 2017 · 6 comments
Open

Add the 'isRoot' predicate #67

mrkkrp opened this issue Mar 2, 2017 · 6 comments

Comments

@mrkkrp
Copy link
Collaborator

mrkkrp commented Mar 2, 2017

This should return True when given path is root (upper level) directory.

@mrkkrp
Copy link
Collaborator Author

mrkkrp commented Mar 2, 2017

Depends on #18.

@mrkkrp mrkkrp added this to the 0.6.0 milestone Mar 2, 2017
@sjakobi
Copy link
Member

sjakobi commented Mar 2, 2017

I'm surprised that I couldn't find an analogous function in either filepath or directory, indicating that maybe it isn't widely needed.

I'm not against adding it, but if it's added, I'd suggest adding it at some place where it doesn't distract from more useful functions.

@joehillen
Copy link
Contributor

I feel like the problems described in #18 and #33 can be caught by expressing the special case for / at the type level rather than throw a runtime exception. I think this could be done in a fairly backwards compatible way. Give me a chance to test out the idea before merging anything.

@joehillen
Copy link
Contributor

Nevermind, my idea wouldn't work without dependent types.

@sjakobi
Copy link
Member

sjakobi commented Mar 29, 2017

I'm surprised that I couldn't find an analogous function in either filepath or directory, indicating that maybe it isn't widely needed.

I overlooked System.FilePath.isDrive there. Not sure if we should also call our function isDrive then. It seems to me that calling a Windows drive like C:\\ a root is more common than calling the Posix root / a drive.

@emmanueltouzery
Copy link

I felt the need for this predicate for searching parent folders. Say you want to search for the .gitignore for a project. I would recursively look at the parent folder searching for the gitignore, until i reach the root folder. Seems like a pretty common use-case?

@mrkkrp mrkkrp removed this from the 0.6.0 milestone Jun 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants