From abf043be149d2321d892cbdfa93c92e4874743ea Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Mon, 30 May 2016 16:02:08 +0200 Subject: [PATCH] Add examples to README --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index 7e8fb56..b866be9 100644 --- a/README.md +++ b/README.md @@ -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) +``` +