{- | Module: Text.NaturalComp.FilePath Copyright: 2013 Hironao Komatsu License: BSD Maintainer: Hironao Komatsu Portability: portable FilePaths are hard to instantiate Stringy, thus newtypes here. -} module Text.NaturalComp.FilePath (FilePathNC (..), FilePathNCC (..)) where import Filesystem.Path.CurrentOS import Prelude hiding (FilePath) import Text.NaturalComp newtype FilePathNC = FilePathNC { getFilePath :: FilePath } newtype FilePathNCC = FilePathNCC { getFilePathC :: FilePath } instance Eq FilePathNC where x == y = let x' = encode $ getFilePath x y' = encode $ getFilePath y in naturalComp x' y' == EQ instance Ord FilePathNC where x `compare` y = let x' = encode $ getFilePath x y' = encode $ getFilePath y in naturalComp x' y' instance Eq FilePathNCC where x == y = let x' = encode $ getFilePathC x y' = encode $ getFilePathC y in naturalCaseComp x' y' == EQ instance Ord FilePathNCC where x `compare` y = let x' = encode $ getFilePathC x y' = encode $ getFilePathC y in naturalCaseComp x' y'