{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
module Path.Like (
PathLike(..)
, FileLike(..)
, DirLike(..)
, (/>)
) where
import Path
class PathLike b t a | a -> b, a -> t where
toPath :: a -> Path b t
class PathLike b File a => FileLike b a where
toFile :: a -> Path b File
toFile = a -> Path b File
forall b t a. PathLike b t a => a -> Path b t
toPath
class PathLike b Dir a => DirLike b a where
toDir :: a -> Path b Dir
toDir = a -> Path b Dir
forall b t a. PathLike b t a => a -> Path b t
toPath
instance PathLike b t (Path b t) where
toPath :: Path b t -> Path b t
toPath = Path b t -> Path b t
forall a. a -> a
id
instance FileLike b (Path b File)
instance DirLike b (Path b Dir)
(/>) :: (DirLike b a, FileLike Rel c) => a -> c -> Path b File
/> :: a -> c -> Path b File
(/>) a
x c
y = a -> Path b Dir
forall b a. DirLike b a => a -> Path b Dir
toDir a
x Path b Dir -> Path Rel File -> Path b File
forall b t. Path b Dir -> Path Rel t -> Path b t
</> c -> Path Rel File
forall b a. FileLike b a => a -> Path b File
toFile c
y