data-filepath 1.0.0.0 → 2.0.0.0
raw patch · 2 files changed
+12/−2 lines, 2 filesnew-uploaderPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Data.FilePath: DirectoryPath :: FilePath a Directory -> String -> FilePath a Directory
- Data.FilePath: FilePath :: FilePath a Directory -> String -> FilePath a File
- Data.FilePath: RelativePath :: FilePath Relative Directory
- Data.FilePath: RootPath :: FilePath Root Directory
- Data.FilePath: instance Typeable (FilePath 'Relative 'Directory)
- Data.FilePath: instance Typeable (FilePath 'Relative 'File)
- Data.FilePath: instance Typeable (FilePath 'Root 'Directory)
- Data.FilePath: instance Typeable (FilePath 'Root 'File)
+ Data.FilePath: Directory :: Path
+ Data.FilePath: File :: Path
+ Data.FilePath: Relative :: From
+ Data.FilePath: Root :: From
+ Data.FilePath: instance Typeable 'Directory
+ Data.FilePath: instance Typeable 'File
+ Data.FilePath: instance Typeable 'Relative
+ Data.FilePath: instance Typeable 'Root
+ Data.FilePath: instance Typeable FilePath
+ Data.FilePath: mkRootFilePathBase :: String -> Maybe (FilePath Root Directory)
Files
- Data/FilePath.hs +11/−1
- data-filepath.cabal +1/−1
Data/FilePath.hs view
@@ -1,5 +1,5 @@ {-# LANGUAGE CPP, GADTs, DataKinds, KindSignatures, StandaloneDeriving, RankNTypes, DeriveDataTypeable, FlexibleInstances, MagicHash #-}-module Data.FilePath (Path, From, FilePath(..), rootPath, relativePath, (</>), mkDirPath, mkFilePath, mkFullFilePath, showp, dirpathQ, filepathQ) where+module Data.FilePath (Path(..), From(..), FilePath, rootPath, relativePath, (</>), mkDirPath, mkFilePath, mkRootFilePathBase, mkFullFilePath, showp, dirpathQ, filepathQ) where import Prelude hiding (FilePath) import Data.Data@@ -37,6 +37,16 @@ mkFilePath :: String -> Maybe (FilePath Relative File) mkFilePath s = FilePath RelativePath `fmap` (mkf s)++mkRootFilePathBase :: String -> Maybe (FilePath Root Directory)+mkRootFilePathBase ('/':s) = do+ ys <- xs+ return $ foldl (</>) (RootPath) ys+ where+ ss = splitOn "/" s+ xs = sequence $ map mkDirPath $ filter (not . null) ss+mkRootFilePathBase _ = Nothing -- all full file paths must start from /+ mkFullFilePath :: String -> Maybe (FilePath Root File) mkFullFilePath ('/':s) = do
data-filepath.cabal view
@@ -1,5 +1,5 @@ name: data-filepath-version: 1.0.0.0+version: 2.0.0.0 synopsis: A type safe file path data structure -- description: license: BSD3