Commit Graph

128 Commits

Author SHA1 Message Date
620550dab4
Minor documentation fixes 2016-05-22 13:28:20 +02:00
5ed249f5d6
Fix haddock 2016-05-18 14:03:50 +02:00
a8ccfc2587
Release 0.7.0 2016-05-18 14:02:08 +02:00
8fec862304
Rm redundant import 2016-05-18 13:48:38 +02:00
646fe7cfea
Doc update 2016-05-18 13:42:31 +02:00
1bf27258c1
Uhm 2016-05-18 13:33:17 +02:00
797dcaf725
Backport changes from posix-paths PR:
* add isFileName
* add hasParentDir
* add hiddenFile
* add our own openFd version for more control
* small documentation improvements
* add a getDirectoryContents' version that works on Fd
* fix linting warnings
* lift version constraints in benchmark

Also adjust HPath.IO to work with the new API.
2016-05-18 04:11:40 +02:00
0fa66cd581
Use sendfile for copying and read/write as fallback 2016-05-18 03:47:39 +02:00
ee3ace362b
HPath.IO: minor doc fix 2016-05-10 12:05:55 +02:00
05fcad14f1
HPath.IO.Errors: minor documentation fix 2016-05-10 02:02:05 +02:00
f841a53985
HPath.IO: pretty 2016-05-10 00:36:51 +02:00
eb27c368e6
HPath.IO.Errors: explicit exports, improve haddock compat 2016-05-10 00:35:33 +02:00
c76df7f159
HPath.IO: small cleanup 2016-05-10 00:28:04 +02:00
613754c58f
HPath.IO: just do 'return ()' on unsupported file types where possible
Breaking the callstack with an ioError seems a bit harsh here.
2016-05-10 00:27:46 +02:00
d8b0b99edf
HPath.IO.Errors: provide all exception constructor checkers 2016-05-10 00:13:14 +02:00
794c3a2fc4
HPath.IO.Errors: remove obsolete HPathIOException constructors 2016-05-10 00:12:43 +02:00
8a28a5dd0f
HPath.IO.Errors: fix throwDestinationInSource
'canonicalizePath' was missing, making this function far less reliable.
In order for this to work we have to work around circular imports
with a IO.hs-boot file.
2016-05-10 00:11:42 +02:00
78a3baeb25
Export PathException 2016-05-09 19:34:19 +02:00
930b021a32
Add missing (<$>) imports 2016-05-09 18:53:26 +02:00
a83e96259f
Fix build with bytestring >= 0.10.8 2016-05-09 18:17:33 +02:00
14b48515a2
Add TODO to _copyFile 2016-05-09 18:15:05 +02:00
820bf8814d
Fix build with GHC versions prior 7.10.x 2016-05-09 18:14:08 +02:00
f27becc4df
Cleanup, improve docs 2016-05-09 17:37:16 +02:00
3bbde22377
Add 'hiddenFile' to System.Posix.FilePath 2016-05-09 17:37:00 +02:00
3da8533b48
Remove 'normalize' from HPath, since it's not needed 2016-05-09 17:04:26 +02:00
687a113252
Fix documentation in System.Posix.FilePath 2016-05-09 17:04:01 +02:00
86a4b9ade2
Add IO modules, previously from HSFM 2016-05-09 16:53:31 +02:00
6638cd8cc1
Create HPath.IO module, adding canonicalizePath again 2016-05-09 14:40:30 +02:00
196647a383
Move some functionality from HPath to System.Posix.FilePath
This also removes 'canonicalizePath' from HPath which fixes
the doctest.
2016-05-09 14:16:53 +02:00
a946387330
Merge posix-paths into hpath 2016-05-09 13:31:20 +02:00
45b515d1db
Add withAbsPath/withRelPath/withFnPath 2016-04-17 18:09:50 +02:00
a5360f29a3
Don't re-export functions 2016-04-16 19:21:19 +02:00
f1875da780
Use latest posix-paths
Pending upstream PR.
2016-04-16 19:12:23 +02:00
7e8c745e35
Clean up, rewrite stuff 2016-04-16 18:17:44 +02:00
577ecf6750
Add normalizeAbs, which may or may not be useful 2016-04-15 14:23:25 +02:00
8f7e5806e3
Be more strict
* don't rely on OverloadedString
* make basename fail if run on root dir "/"
* reject "." and ".." in filename parser
* reject ".." in path parsers
* normalise paths in parsers
2016-04-15 14:23:07 +02:00
c570505297
Add hiddenFile function 2016-04-10 21:50:52 +02:00
148eeb619f
Implement String -> ByteString and vice versa conversion for filepaths 2016-04-05 00:55:25 +02:00
877d8c4089
Implement equalFilePath 2016-04-05 00:54:55 +02:00
8c1bd139c0
Readd TH constructors 2016-04-05 00:54:36 +02:00
bd71947b2a
Use word8 package 2016-04-04 18:46:25 +02:00
491efe44a3
Use ByteString for paths instead of String 2016-04-04 17:29:35 +02:00
hasufell
c7229061d0 Fix encoding issues with realPath 2016-04-04 03:06:22 +02:00
3a52a9ea4b
Add getAllParents 2016-04-03 16:20:38 +02:00
3c3a2d2766
Switch to new layout 2016-03-30 02:47:42 +02:00
d15e4b8ad9 Fork chrisdone's path library
I wasn't happy with the way it dealt with Dir vs File things. In his
version of the library, a `Path b Dir` always ends with a trailing
path separator and `Path b File` never ends with a trailing path separator.

IMO, it is nonsensical to make a Dir vs File distinction on path level,
although it first seems nice.
Some of the reasons are:
* a path is just that: a path. It is completely disconnected from IO level
  and even if a `Dir`/`File` type theoretically allows us to say "this path
  ought to point to a file", there is literally zero guarantee that it will
  hold true at runtime. So this basically gives a false feeling of a
  type-safe file distinction.
* it's imprecise about Dir vs File distinction, which makes it even worse,
  because a directory is also a file (just not a regular file). Add symlinks
  to that and the confusion is complete.
* it makes the API oddly complicated for use cases where we basically don't
  care (yet) whether something turns out to be a directory or not

Still, it comes also with a few perks:
* it simplifies some functions, because they now have guarantees whether a
  path ends in a trailing path separator or not
* it may be safer for interaction with other library functions, which behave
  differently depending on a trailing path separator (like probably shelly)

Not limited to, but also in order to fix my remarks without breaking any
benefits, I did:
* rename the `Dir`/`File` types to `TPS`/`NoTPS`, so it's clear we are only
  giving information about trailing path separators and not actual file
  types we don't know about yet
* add a `MaybeTPS` type, which does not mess with trailing path separators
  and also gives no guarantees about them... then added `toNoTPS` and
  `toTPS` to allow type-safe conversion
* make some functions accept more general types, so we don't unnecessarily
  force paths with trailing separators for `(</>)` for example... instead
  these functions now examine the paths to still have correct behavior.
  This is really minor overhead. You might say now "but then I can append
  filepath to filepath". Well, as I said... we don't know whether it's a
  "filepath" at all.
* merge `filename` and `dirname` into `basename` and make `parent` be
  `dirname`, so the function names match the name of the POSIX ones,
  which do (almost) the same...
* fix a bug in `basename` (formerly `dirname`) which broke the type
  guarantees
* add a pattern synonym for easier pattern matching without exporting
  the internal Path constructor
2016-03-08 22:53:42 +01:00
Felix Yan
05271c94af Fix a haddock parse error
The line was triggering parse error when running haddock:

```
src/Path.hs:16:1:
    parse error on input ‘-- | A normalizing well-typed path type.’
```

Removing it works for me.
2016-03-05 13:44:08 +08:00
Chris Done
9d357b24c8 Remove redundant check for /= . or .. 2016-03-04 15:11:06 +01:00
Chris Done
04608e0e53 Reject only .. and . (#13) 2016-03-04 15:06:27 +01:00
Chris Done
540c24f3a5 Use FilePath.isValid (#12) 2016-03-04 14:49:21 +01:00
Chris Done
2e109c86d8 Reject path consisting of all "." (fixes #13)
Ping @mrkkrp
2016-03-04 14:39:17 +01:00
Chris Done
04fa5d3ea8 Merge pull request #9 from magthe/ClarifyRelative
Clarify what limitations the RelX parsers have.
2016-03-04 14:29:52 +01:00
mrkkrp
01d0f5c968 Add standard header to the ‘Path’ module
The header is nice to have, it's displayed in Haddocks.
2016-01-28 18:10:27 +06:00
mrkkrp
36cc9af231 Fix a typo 2016-01-16 17:22:34 +06:00
Rhys
cd470f2d11 Add NFData instance for Path 2016-01-15 12:07:27 +11:00
Magnus Therning
b5cff315a1 Clarify what limitations the RelX parsers have.
Signed-off-by: Magnus Therning <magnus@therning.org>
2016-01-07 16:15:06 +01:00
mrkkrp
00fabad1f4 Add type-safe synonyms of ‘toFilePath’
This helps to “double check” programmers' assumptions about what kind of
path he is converting into ‘FilePath’. Without these synonyms it's
possible to silently convert wrong type of path into ‘FilePath’.
2015-11-21 16:15:34 +06:00
mrkkrp
733fa04ac3 Write ‘isPrefixOf’ and friends in infix form 2015-11-21 16:14:54 +06:00
mrkkrp
339f7587a3 Remove unused language pragmas 2015-11-21 16:13:52 +06:00
Michael Sloan
1841d7451c Improve a few property definitions
The properties for stripDir and parent used the name 'parent' as a
variable.

The properties for filename and dirname seemed to be wrong and also used
'parent' as a variable.
2015-10-08 03:00:50 -07:00
Adam Bergmark
9f229ecef3 Remove unused DeriveGeneric extension, fixes GHC 7.0 build 2015-06-21 02:29:25 +02:00
Chris Done
44d9e02cc2 Add note in docs about dropTrailingPathSeparator 2015-06-18 08:58:01 +02:00
Chris Done
df1e191517 Fix syntax error 2015-06-17 18:45:34 +02:00
Michael Snoyman
9ca83d66b8 Handle parent directory checks on Windows 2015-06-17 19:21:45 +03:00
Chris Done
4e1816392a Fix stripDir p p /= Nothing bug 2015-05-27 17:08:03 +02:00
Chris Done
ffdf4af243 Generalize stripDir to MonadThrow 2015-05-22 11:35:52 +02:00
Chris Done
87a56a93b8 Disallow .. 2015-05-22 11:35:52 +02:00
kraai
0c1dd7e493 Add ellipsis 2015-05-14 15:44:41 +00:00
Chris Done
07aa83ca19 Remove Generic 2015-05-14 08:01:14 +02:00
Chris Done
d373cacedb Add dirname 2015-05-11 18:59:26 +02:00
Chris Done
ef8503f38f Rename parentAbs to parent 2015-05-11 18:40:54 +02:00
Chris Done
c0e93d2167 Restrict parentAbs return to Dir 2015-05-11 08:58:34 +02:00
Chris Done
cb5545f2fe Add Typeable instances 2015-05-11 08:47:17 +02:00
Chris Done
3621b46b44 Fix docs 2015-05-08 15:57:03 +02:00
Chris Done
cf7139b381 Add some commentary 2015-05-08 14:18:03 +02:00
Chris Done
c4895949ee Add some operations 2015-05-08 14:03:37 +02:00
Chris Done
1e5b6675c2 Basic Path type with parsers and test suite 2015-05-08 13:14:54 +02:00
Chris Done
accc5c3794 First commit 2015-05-07 20:15:42 +02:00