You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
Julian Ospald 456af3b1ab
Release 0.6.0
7 years ago
benchmarks Merge posix-paths into hpath 8 years ago
cbits Merge posix-paths into hpath 8 years ago
src HPath.IO: pretty 7 years ago
test Add missing (<$>) imports 7 years ago
.ghci Basic Path type with parsers and test suite 9 years ago
.gitignore Fork chrisdone's path library 8 years ago
.travis.yml Raise cabal version to fix travis build 7 years ago
CHANGELOG Release 0.6.0 7 years ago
LICENSE Add IO modules, previously from HSFM 7 years ago
README.md Add travis icon to README 7 years ago
Setup.hs First commit 9 years ago
doctests-hpath.hs TESTS: minor doctest cleanup 8 years ago
doctests-posix.hs Merge posix-paths into hpath 8 years ago
hpath.cabal Release 0.6.0 7 years ago

README.md

HPath

Build Status

Support for well-typed paths in Haskell. Also provides ByteString based filepath manipulation.

Motivation

The motivation came during development of hsfm which has a pretty strict File type, but lacks a strict Path type, e.g. for user input.

The library that came closest to my needs was path, but the API turned out to be oddly complicated for my use case, so I decided to fork it.

Similarly, posix-paths was exactly what I wanted for the low-level operations, but upstream seems dead, so it is forked as well and merged into this library.

Goals

  • well-typed paths
  • high-level API to file operations like recursive directory copy
  • safe filepath manipulation, never using String as filepath, but ByteString
  • still allowing sufficient control to interact with the underlying low-level calls

Differences to ‘path’

  • doesn’t attempt to fake IO-related information into the path, so whether a path points to a file or directory is up to your IO-code to decide...
  • trailing path separators will be preserved if they exist, no messing with that
  • uses safe ByteString for filepaths under the hood instead of unsafe String
  • fixes broken dirname
  • renames dirname/filename to basename/dirname to match the POSIX shell functions
  • introduces a new Path Fn for safe filename guarantees and a RelC class
  • allows pattern matching via unidirectional PatternSynonym
  • uses simple doctest for testing
  • allows ~/ as relative path, because on posix level ~ is just a regular filename that does NOT point to $HOME
  • remove TH, it sucks

Differences to ‘posix-paths’

  • hasTrailingPathSeparator behaves in the same way as System.FilePath
  • dropTrailingPathSeparator behaves in the same way as System.FilePath
  • added various functions like isValid, normalise and equalFilePath
  • uses the word8 package for save word8 literals instead of OverloadedStrings
  • has custom versions of openFd and getDirectoryContents