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