packages feed

liquid-platform 0.9.2.5 → 0.9.2.8

raw patch · 2 files changed

+21/−33 lines, 2 filesdep −cmdargsdep ~liquid-preludedep ~liquid-vectordep ~liquidhaskell

Dependencies removed: cmdargs

Dependency ranges changed: liquid-prelude, liquid-vector, liquidhaskell, liquidhaskell-boot

Files

liquid-platform.cabal view
@@ -1,6 +1,6 @@ cabal-version:      1.22 name:               liquid-platform-version:            0.9.2.5+version:            0.9.2.8 synopsis:           A battery-included platform for LiquidHaskell description:        A battery-included platform for LiquidHaskell. license:            BSD3@@ -27,13 +27,12 @@     buildable: True     build-depends:      base       >= 4.15.1.0 && < 5                       , containers >= 0.6.4.1  && < 0.7-                      , liquid-prelude    >= 0.9.2.5-                      , liquid-vector     >= 0.12.3.1.2-                      , liquidhaskell     >= 0.9.2.5-                      , liquidhaskell-boot >= 0.9.2.5+                      , liquid-prelude    >= 0.9.2.8+                      , liquid-vector     >= 0.13.1.0+                      , liquidhaskell     >= 0.9.2.8+                      , liquidhaskell-boot >= 0.9.2.8                       , filepath                       , process           >= 1.6.0.0 && < 1.7-                      , cmdargs           >= 0.10    && < 0.11    if flag(devel)     ghc-options: -Werror
src/Liquid.hs view
@@ -13,35 +13,20 @@ import Control.Monad  import System.Environment (lookupEnv, getArgs, unsetEnv)-import System.FilePath ((</>), takeDirectory, takeExtension)+import System.FilePath ((</>), takeDirectory) import System.Process import System.Exit-import Data.Char (toLower) import Data.Maybe-import Data.Either (partitionEithers) import Data.Bifunctor-import Data.Functor ((<&>))-import qualified System.Console.CmdArgs.Explicit as CmdArgs-import Data.List (partition, isPrefixOf, (\\))+import Data.List (isPrefixOf, (\\)) -import Language.Haskell.Liquid.UX.CmdLine (config, printLiquidHaskellBanner, getOpts)+import Language.Haskell.Liquid.UX.CmdLine (printLiquidHaskellBanner, getOpts)  type GhcArg    = String type LiquidArg = String  partitionArgs :: [String] -> ([GhcArg], [LiquidArg])-partitionArgs args = partitionEithers (map parseArg args)-  where-    parseArg :: String -> Either GhcArg LiquidArg-    parseArg a-      | forwardToGhc a = Left a-      | otherwise      = bimap (const a) (const a) (CmdArgs.process config [a])--    -- Unfortunate consequence of the facts things like '-i' needs to be forwarded to GHC-    -- and not the LH executable.-    forwardToGhc :: String -> Bool-    forwardToGhc = isPrefixOf "-i"-+partitionArgs = second (drop 1) . break ("--"==)  helpNeeded :: [String] -> Bool helpNeeded = elem "--help"@@ -65,18 +50,23 @@   -- If no args are passed, display the help instead of ghc's "no input files." To do so,   -- due to the fact GHC needs to always have an input file to actually run a source plugin, we   -- run this with '--interactive'.-  args <- getArgs <&> \case [] -> ["--interactive", "--help"]-                            xs -> "--make" : xs+  args0 <- getArgs+  when (null args0 || elem "--help" args0) $+    putStr $ unlines+      [ "Usage:"+      , ""+      , "    liquidhaskell <ghc arguments> [-- <Liquid Haskell arguments>]"+      , ""+      ]+  let args = case args0 of+               [] -> ["--interactive", "--", "--help"]+               xs -> "--make" : xs    ghcPath <- fromMaybe "ghc" <$> lookupEnv "LIQUID_GHC_PATH"    packageDbs <- collectPackageDbsFromGHC_ENVIRONMENT -  -- Strip targets out of the arguments, so that we can forward them to GHC before they-  -- get intercepted by the LH parser.-  let (targets, cliArgs)    =-        partition ((`elem` [".o", ".hs", ".lhs"]) . map toLower . takeExtension) args-  let (ghcArgs, liquidArgs) = partitionArgs cliArgs+  let (ghcArgs, liquidArgs) = partitionArgs args    let p = proc ghcPath $                          ["-package-env", "-"]@@ -90,7 +80,6 @@                          ]                          <> map (mappend "-fplugin-opt=LiquidHaskell:") liquidArgs                          <> ghcArgs-                         <> targets    -- Call into 'getOpts' so that things like the json reporter will correctly set the verbosity of the   -- logging and avoid printing the banner.