From 7d3b89369d7e9847b53379a83fb6f8ff7328dcac Mon Sep 17 00:00:00 2001 From: Alexis Williams <alexis@typedr.at> Date: Sat, 7 Jul 2018 10:45:35 -0700 Subject: [PATCH] Expose `parseGhcEnvironmentFile`. --- Cabal/Distribution/Simple/GHC.hs | 1 + Cabal/Distribution/Simple/GHC/EnvironmentParser.hs | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Cabal/Distribution/Simple/GHC.hs b/Cabal/Distribution/Simple/GHC.hs index 6720195ae3..5361906fb3 100644 --- a/Cabal/Distribution/Simple/GHC.hs +++ b/Cabal/Distribution/Simple/GHC.hs @@ -60,6 +60,7 @@ module Distribution.Simple.GHC ( Internal.writeGhcEnvironmentFile, Internal.ghcPlatformAndVersionString, readGhcEnvironmentFile, + parseGhcEnvironmentFile, ParseErrorExc(..), -- * Version-specific implementation quirks getImplInfo, diff --git a/Cabal/Distribution/Simple/GHC/EnvironmentParser.hs b/Cabal/Distribution/Simple/GHC/EnvironmentParser.hs index 239933f99c..d6987b6d0c 100644 --- a/Cabal/Distribution/Simple/GHC/EnvironmentParser.hs +++ b/Cabal/Distribution/Simple/GHC/EnvironmentParser.hs @@ -5,7 +5,7 @@ {-# LANGUAGE RankNTypes #-} {-# LANGUAGE RecordWildCards #-} module Distribution.Simple.GHC.EnvironmentParser - ( readGhcEnvironmentFile, ParseErrorExc(..) ) where + ( parseGhcEnvironmentFile, readGhcEnvironmentFile, ParseErrorExc(..) ) where import Prelude () import Distribution.Compat.Prelude @@ -42,10 +42,10 @@ newtype ParseErrorExc = ParseErrorExc P.ParseError instance Exception ParseErrorExc -parseEnvironmentFile :: Parser [GhcEnvironmentFileEntry] -parseEnvironmentFile = parseEnvironmentFileLine `P.sepEndBy` P.endOfLine <* P.eof +parseGhcEnvironmentFile :: Parser [GhcEnvironmentFileEntry] +parseGhcEnvironmentFile = parseEnvironmentFileLine `P.sepEndBy` P.endOfLine <* P.eof readGhcEnvironmentFile :: FilePath -> IO [GhcEnvironmentFileEntry] readGhcEnvironmentFile path = either (throwIO . ParseErrorExc) return =<< - parseFromFile parseEnvironmentFile path + parseFromFile parseGhcEnvironmentFile path -- GitLab