path-like 0.1.1.0 → 0.1.2.0
raw patch · 3 files changed
+16/−16 lines, 3 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Path.Like: class PathLike b Dir a => DirLike b a
- Path.Like: class PathLike b File a => FileLike b a
- Path.Like: instance Path.Like.DirLike b (Path.Internal.Path b Path.Posix.Dir)
- Path.Like: instance Path.Like.FileLike b (Path.Internal.Path b Path.Posix.File)
- Path.Like: instance Path.Like.PathLike b t (Path.Internal.Path b t)
+ Path.Like: type DirLike b a = PathLike b Dir a
+ Path.Like: type FileLike b a = PathLike b File a
Files
- ChangeLog.md +4/−0
- path-like.cabal +1/−1
- src/Path/Like.hs +11/−15
ChangeLog.md view
@@ -1,5 +1,9 @@ # Changelog for path-like +## (v0.1.2.0)++* Change to ConstraintKinds style.+ ## (v0.1.1.0) * Add 'PathLike` superclass to `FileLike` and `DirLike`.
path-like.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: path-like-version: 0.1.1.0+version: 0.1.2.0 synopsis: PathLike, FileLike and DirLike type classes for the Path library. description: Type classes for the Path library. Exports PathLike, FileLike and DirLike classes so that stricter types may be used as Paths. category: Filesystem
src/Path/Like.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FunctionalDependencies #-}@@ -14,8 +15,10 @@ module Path.Like ( PathLike(..)-, FileLike(..)-, DirLike(..)+, FileLike+, DirLike+, toFile+, toDir , (/>) ) where @@ -25,21 +28,14 @@ class PathLike b t a | a -> b, a -> t where toPath :: a -> Path b t --- | Class representing a type `a` that can be compiled down to a `Path b File`.-class PathLike b File a => FileLike b a where- toFile :: a -> Path b File- toFile = toPath---- | Class repreenting a type `a` that can be compiled down to a `Path b Dir`.-class PathLike b Dir a => DirLike b a where- toDir :: a -> Path b Dir- toDir = toPath+type FileLike b a = PathLike b File a+type DirLike b a = PathLike b Dir a -instance PathLike b t (Path b t) where- toPath = id+toFile :: FileLike b a => a -> Path b File+toFile = toPath -instance FileLike b (Path b File)-instance DirLike b (Path b Dir)+toDir :: DirLike b a => a -> Path b Dir+toDir = toPath -- | Like `Path.</>`, but works for any `DirLike` and relative `FileLike` to produce a concrete `Path`. (/>) :: (DirLike b a, FileLike Rel c) => a -> c -> Path b File