Skip to content

Commit

Permalink
Add examples to README
Browse files Browse the repository at this point in the history
  • Loading branch information
hasufell committed May 30, 2016
1 parent 10adc4b commit abf043b
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,26 @@ Note: this library was written for __posix__ systems and it will probably not su
* has a custom versions of `openFd` which allows more control over the flags than its unix package counterpart
* adds a `getDirectoryContents'` version that works on Fd

## Examples in ghci

Start ghci via `cabal repl`:

```hs
-- enable OverloadedStrings
:set -XOverloadedStrings
-- import HPath.IO
import HPath.IO
-- parse an absolute path
abspath <- parseAbs "/home"
-- parse a relative path (e.g. user users home directory)
relpath <- parseRel "jule"
-- concatenate paths
let newpath = abspath </> relpath
-- get file type
getFileType newpath
-- return all contents of that directory
getDirsFiles newpath
-- return all contents of the parent directory
getDirsFiles (dirname newpath)
```

0 comments on commit abf043b

Please sign in to comment.