path-extra 0.0.1 → 0.0.2
raw patch · 2 files changed
+42/−2 lines, 2 files
Files
- path-extra.cabal +1/−1
- src/Path/Extended.hs +41/−1
path-extra.cabal view
@@ -1,5 +1,5 @@ Name: path-extra-Version: 0.0.1+Version: 0.0.2 Author: Athan Clark <athan.clark@gmail.com> Maintainer: Athan Clark <athan.clark@gmail.com> License: BSD3
src/Path/Extended.hs view
@@ -1,3 +1,7 @@+{-# LANGUAGE+ MultiParamTypeClasses+ #-}+ module Path.Extended ( -- * Types Location@@ -28,10 +32,16 @@ , module P ) where -import Path as P+import Path as P hiding ((</>))+import qualified Path as P ((</>))+ import Data.List (intercalate) +class PathAppend right base type' where+ (</>) :: Path base Dir -> right Rel type' -> right base type'++ -- | A location for some base and type - internally uses @Path@. data Location b t = Location { locParentJumps :: Int -- ^ only when b ~ Rel@@ -40,6 +50,36 @@ , locQueryParams :: [QueryParam] , locFragment :: Maybe String } deriving (Eq, Ord)+++instance PathAppend Path Abs Dir where+ (</>) = (P.</>)++instance PathAppend Path Abs File where+ (</>) = (P.</>)++instance PathAppend Path Rel Dir where+ (</>) = (P.</>)++instance PathAppend Path Rel File where+ (</>) = (P.</>)++instance PathAppend Location Abs Dir where+ l </> (Location ps pa fe qp fr) =+ Location ps ((P.</>) l pa) fe qp fr++instance PathAppend Location Abs File where+ l </> (Location ps pa fe qp fr) =+ Location ps ((P.</>) l pa) fe qp fr++instance PathAppend Location Rel Dir where+ l </> (Location ps pa fe qp fr) =+ Location ps ((P.</>) l pa) fe qp fr++instance PathAppend Location Rel File where+ l </> (Location ps pa fe qp fr) =+ Location ps ((P.</>) l pa) fe qp fr+ instance Show (Location b t) where show (Location js pa fe qp fr) =