diff --git a/.gitignore b/.gitignore index dcfd17f2..e41e6fdd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ GNUmakefile dist-install/ dist-newstyle/ +dist-mcabal/ dist/ ghc.mk .stack-work/ diff --git a/System/FilePath/Internal.hs b/System/FilePath/Internal.hs index eeb11f35..5f714c4f 100644 --- a/System/FilePath/Internal.hs +++ b/System/FilePath/Internal.hs @@ -132,7 +132,7 @@ import Data.List(stripPrefix, isSuffixOf, uncons, dropWhileEnd) import Prelude (fromIntegral, return, IO, Either(..)) import Control.Exception ( catch, displayException, evaluate, fromException, toException, throwIO, Exception, SomeAsyncException(..), SomeException ) import Control.DeepSeq (force) -import GHC.IO (unsafePerformIO) +import System.IO.Unsafe (unsafePerformIO) import qualified Data.Char as C #ifdef WINDOWS import GHC.IO.Encoding.Failure ( CodingFailureMode(..) ) diff --git a/System/OsPath/Internal.hs b/System/OsPath/Internal.hs index bc1d5a9b..43ecd71a 100644 --- a/System/OsPath/Internal.hs +++ b/System/OsPath/Internal.hs @@ -24,8 +24,12 @@ import GHC.IO.Encoding.Failure ( CodingFailureMode(..) ) import System.OsString.Internal.Types import System.OsPath.Encoding import Control.Monad (when) +#if !defined(__MHS__) import System.IO ( TextEncoding ) +#else +import GHC.IO.Encoding.Types ( TextEncoding ) +#endif #if defined(mingw32_HOST_OS) || defined(__MINGW32__) import qualified System.OsPath.Windows as PF @@ -124,6 +128,7 @@ fromBytes = OS.fromBytes +#if defined(MIN_VERSION_template_haskell) || defined(MIN_VERSION_template_haskell_quasi_quoter) -- | QuasiQuote an 'OsPath'. This accepts Unicode characters -- and encodes as UTF-8 on unix and UTF-16LE on windows. Runs 'isValid' -- on the input. If used as a pattern, requires turning on the @ViewPatterns@ @@ -159,6 +164,10 @@ osp = QuasiQuoter fail "illegal QuasiQuote (allowed as expression or pattern only, used as a declaration)" } #endif +#else +osp :: a +osp = error "Systen.OsPath.Internal.ostr: no Template Haskell" +#endif /* defined(MIN_VERSION_template_haskell) || defined(MIN_VERSION_template_haskell_quasi_quoter) */ -- | Unpack an 'OsPath' to a list of 'OsChar'. diff --git a/System/OsPath/Posix.hs b/System/OsPath/Posix.hs index fc62c86b..98e611d5 100644 --- a/System/OsPath/Posix.hs +++ b/System/OsPath/Posix.hs @@ -11,6 +11,7 @@ #include "Common.hs" +#if defined(MIN_VERSION_template_haskell) || defined(MIN_VERSION_template_haskell_quasi_quoter) -- | QuasiQuote a 'PosixPath'. This accepts Unicode characters -- and encodes as UTF-8. Runs 'isValid' on the input. pstr :: QuasiQuoter @@ -29,3 +30,8 @@ pstr = , quoteDec = \_ -> fail "illegal QuasiQuote (allowed as expression or pattern only, used as a declaration)" } +#else +pstr :: a +pstr = error "Systen.OsPath.Posix.pstr: no Template Haskell" +#endif /* defined(MIN_VERSION_template_haskell) || defined(MIN_VERSION_template_haskell_quasi_quoter) */ + diff --git a/System/OsPath/Windows.hs b/System/OsPath/Windows.hs index ab9efc03..b3028f9f 100644 --- a/System/OsPath/Windows.hs +++ b/System/OsPath/Windows.hs @@ -11,7 +11,7 @@ #include "Common.hs" - +#if defined(MIN_VERSION_template_haskell) || defined(MIN_VERSION_template_haskell_quasi_quoter) -- | QuasiQuote a 'WindowsPath'. This accepts Unicode characters -- and encodes as UTF-16LE. Runs 'isValid' on the input. pstr :: QuasiQuoter @@ -30,3 +30,7 @@ pstr = , quoteDec = \_ -> fail "illegal QuasiQuote (allowed as expression or pattern only, used as a declaration)" } +#else +pstr :: a +pstr = error "Systen.OsPath.Windows.pstr: no Template Haskell" +#endif /* defined(MIN_VERSION_template_haskell) || defined(MIN_VERSION_template_haskell_quasi_quoter) */ diff --git a/filepath.cabal b/filepath.cabal index d9c91b24..4f5445a2 100644 --- a/filepath.cabal +++ b/filepath.cabal @@ -95,8 +95,13 @@ library , bytestring >=0.11.3.0 , deepseq , exceptions - , template-haskell , os-string >=2.0.1 + if impl(ghc) + build-depends: + template-haskell + if impl(mhs) + build-depends: + ghc-compat ghc-options: -Wall