From 95c6a84dfe889fd9fd00fee66c2c39fd8cf1721c Mon Sep 17 00:00:00 2001 From: travis-ci Date: Sat, 14 Jan 2017 19:23:15 +0000 Subject: [PATCH] Lastest docs updated travis build: 87 commit: 1a2c77c6a6f14483ce1b88805bd9ae0963f2cf81 auto-pushed to gh-pages --- HPath-IO-Utils.html | 6 --- HPath.html | 2 +- hpath.haddock | Bin 117588 -> 117340 bytes mini_HPath-IO-Utils.html | 4 -- src/HPath-IO-Utils.html | 43 ------------------- src/HPath.html | 90 +++++++++++++++++++-------------------- 6 files changed, 44 insertions(+), 101 deletions(-) delete mode 100644 HPath-IO-Utils.html delete mode 100644 mini_HPath-IO-Utils.html delete mode 100644 src/HPath-IO-Utils.html diff --git a/HPath-IO-Utils.html b/HPath-IO-Utils.html deleted file mode 100644 index c44844c..0000000 --- a/HPath-IO-Utils.html +++ /dev/null @@ -1,6 +0,0 @@ -HPath.IO.Utils

hpath-0.8.0: Support for well-typed paths

Copyright© 2016 Julian Ospald
LicenseBSD3
MaintainerJulian Ospald <hasufell@posteo.de>
Stabilityexperimental
Portabilityportable
Safe HaskellSafe
LanguageHaskell2010

HPath.IO.Utils

Description

Random and general IO/monad utilities.

Synopsis

Documentation

whenM :: Monad m => m Bool -> m () -> m () Source #

If the value of the first argument is True, then execute the action - provided in the second argument, otherwise do nothing.

unlessM :: Monad m => m Bool -> m () -> m () Source #

If the value of the first argument is False, then execute the action - provided in the second argument, otherwise do nothing.

\ No newline at end of file diff --git a/HPath.html b/HPath.html index bd0ab8e..783dbb0 100644 --- a/HPath.html +++ b/HPath.html @@ -74,7 +74,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_HPath.html");}; Just "dod" >>> basename (MkPath "/") :: Maybe (Path Fn) Nothing -

dirname :: Path Abs -> Path Abs Source #

Extract the directory name of a path.

The following properties hold:

dirname (p </> a) == dirname p
>>> dirname (MkPath "/abc/def/dod")
+

dirname :: Path Abs -> Path Abs Source #

Extract the directory name of a path.

>>> dirname (MkPath "/abc/def/dod")
 "/abc/def"
 >>> dirname (MkPath "/")
 "/"
diff --git a/hpath.haddock b/hpath.haddock
index a0cd060250feb43464bbdb48680f79e08f6ac7d0..b15b592dede8f922993de8c353ea82adeb135fc3 100644
GIT binary patch
delta 97
zcmV-n0G|KUmIvIF2M!Gk`py6x00Fe^00F2#u@3F+0}lcpm*EltBa^`ID3gHA46{w|
zw8j=USWR?HGcz$}VPZ;nc``LkPkMGjRJRwl0rm)&QojKtmo>iu9hVKi0Vub2zX9G0
DGh`)6

delta 105
zcmV-v0G9vUln2z72M!Gk`py6x00Fh-00F5uu@3F+lZ@|w0Une7?I)8r@GzI?G64*e
z4ek^HaI^dE4#yTVcs4UvNJlw%X-7h4WK>W|d242DPq!bn0rm)&R=xo!mpQ%x9hVip
L0VKD6z5(6~2v90(

diff --git a/mini_HPath-IO-Utils.html b/mini_HPath-IO-Utils.html
deleted file mode 100644
index 1ce788b..0000000
--- a/mini_HPath-IO-Utils.html
+++ /dev/null
@@ -1,4 +0,0 @@
-HPath.IO.Utils

HPath.IO.Utils

\ No newline at end of file diff --git a/src/HPath-IO-Utils.html b/src/HPath-IO-Utils.html deleted file mode 100644 index 0846c71..0000000 --- a/src/HPath-IO-Utils.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - - -src/HPath/IO/Utils.hs - - - -
-- |
--- Module      :  HPath.IO.Utils
--- Copyright   :  © 2016 Julian Ospald
--- License     :  BSD3
---
--- Maintainer  :  Julian Ospald <hasufell@posteo.de>
--- Stability   :  experimental
--- Portability :  portable
---
--- Random and general IO/monad utilities.
-
-
-module HPath.IO.Utils where
-
-
-import Control.Monad
-  (
-    when
-  , unless
-  )
-
-
--- |If the value of the first argument is True, then execute the action
--- provided in the second argument, otherwise do nothing.
-whenM :: Monad m => m Bool -> m () -> m ()
-whenM mb a = mb >>= (`when` a)
-
-
--- |If the value of the first argument is False, then execute the action
--- provided in the second argument, otherwise do nothing.
-unlessM :: Monad m => m Bool -> m () -> m ()
-unlessM mb a = mb >>= (`unless` a)
-
- diff --git a/src/HPath.html b/src/HPath.html index a5f5bf8..3ce1e3b 100644 --- a/src/HPath.html +++ b/src/HPath.html @@ -323,63 +323,59 @@ -- | Extract the directory name of a path. -- --- The following properties hold: --- --- @dirname (p \<\/> a) == dirname p@ --- --- >>> dirname (MkPath "/abc/def/dod") --- "/abc/def" --- >>> dirname (MkPath "/") --- "/" -dirname :: Path Abs -> Path Abs -dirname (MkPath fp) = MkPath (takeDirectory $ dropTrailingPathSeparator fp) - --- | Extract the file part of a path. --- +-- >>> dirname (MkPath "/abc/def/dod") +-- "/abc/def" +-- >>> dirname (MkPath "/") +-- "/" +dirname :: Path Abs -> Path Abs +dirname (MkPath fp) = MkPath (takeDirectory $ dropTrailingPathSeparator fp) + +-- | Extract the file part of a path. +-- +-- +-- The following properties hold: +-- +-- @basename (p \<\/> a) == basename a@ -- --- The following properties hold: +-- Throws: `PathException` if given the root path "/" -- --- @basename (p \<\/> a) == basename a@ --- --- Throws: `PathException` if given the root path "/" --- --- >>> basename (MkPath "/abc/def/dod") :: Maybe (Path Fn) --- Just "dod" --- >>> basename (MkPath "/abc/def/dod/") :: Maybe (Path Fn) --- Just "dod" --- >>> basename (MkPath "/") :: Maybe (Path Fn) --- Nothing -basename :: MonadThrow m => Path b -> m (Path Fn) -basename (MkPath l) - | not (isAbsolute rl) = return $ MkPath rl - | otherwise = throwM RootDirHasNoBasename - where - rl = last . splitPath . dropTrailingPathSeparator $ l +-- >>> basename (MkPath "/abc/def/dod") :: Maybe (Path Fn) +-- Just "dod" +-- >>> basename (MkPath "/abc/def/dod/") :: Maybe (Path Fn) +-- Just "dod" +-- >>> basename (MkPath "/") :: Maybe (Path Fn) +-- Nothing +basename :: MonadThrow m => Path b -> m (Path Fn) +basename (MkPath l) + | not (isAbsolute rl) = return $ MkPath rl + | otherwise = throwM RootDirHasNoBasename + where + rl = last . splitPath . dropTrailingPathSeparator $ l + + +-------------------------------------------------------------------------------- +-- Path IO helpers --------------------------------------------------------------------------------- --- Path IO helpers +withAbsPath :: Path Abs -> (ByteString -> IO a) -> IO a +withAbsPath (MkPath p) action = action p -withAbsPath :: Path Abs -> (ByteString -> IO a) -> IO a -withAbsPath (MkPath p) action = action p +withRelPath :: Path Rel -> (ByteString -> IO a) -> IO a +withRelPath (MkPath p) action = action p -withRelPath :: Path Rel -> (ByteString -> IO a) -> IO a -withRelPath (MkPath p) action = action p +withFnPath :: Path Fn -> (ByteString -> IO a) -> IO a +withFnPath (MkPath p) action = action p -withFnPath :: Path Fn -> (ByteString -> IO a) -> IO a -withFnPath (MkPath p) action = action p +------------------------ +-- ByteString helpers - ------------------------- --- ByteString helpers - -#if MIN_VERSION_bytestring(0,10,8) -#else -stripPrefix :: ByteString -> ByteString -> Maybe ByteString -stripPrefix a b = BS.pack `fmap` L.stripPrefix (BS.unpack a) (BS.unpack b) -#endif +#if MIN_VERSION_bytestring(0,10,8) +#else +stripPrefix :: ByteString -> ByteString -> Maybe ByteString +stripPrefix a b = BS.pack `fmap` L.stripPrefix (BS.unpack a) (BS.unpack b) +#endif