{-# LANGUAGE CPP #-}

-- | Compatibility module to avoid compiler warnings about deprecation
-- of obsolete Turtle functionality related to FilePath.  Once we
-- no longer support pre-1.6 Turtle we can eliminate this module.
module Turtle.Compat
  ( absolute
  , collapse
  , encodeString
  , fromText
  , toText
  ) where

import qualified Turtle

#if MIN_VERSION_turtle(1,6,0)

import qualified Data.Text
import qualified System.FilePath

absolute :: FilePath -> Bool
absolute = FilePath -> Bool
System.FilePath.isAbsolute
collapse :: FilePath -> FilePath
collapse = FilePath -> FilePath
System.FilePath.normalise
encodeString :: FilePath -> FilePath
encodeString = FilePath -> FilePath
forall a. a -> a
id
fromText :: Text -> FilePath
fromText = Text -> FilePath
Data.Text.unpack
toText :: FilePath -> Either Text Text
toText = Text -> Either Text Text
forall a b. b -> Either a b
Right (Text -> Either Text Text)
-> (FilePath -> Text) -> FilePath -> Either Text Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> Text
Data.Text.pack

#else

absolute = Turtle.absolute
collapse = Turtle.collapse
encodeString = Turtle.encodeString
fromText = Turtle.fromText
toText = Turtle.toText

#endif

absolute :: Turtle.FilePath -> Bool
collapse :: Turtle.FilePath -> Turtle.FilePath
encodeString :: Turtle.FilePath -> String
fromText :: Turtle.Text -> Turtle.FilePath
toText :: Turtle.FilePath -> Either Turtle.Text Turtle.Text