packages feed

liquid-platform 0.8.10.2 → 0.9.0.2

raw patch · 2 files changed

+49/−22 lines, 2 filesdep +filepathdep ~basedep ~liquid-basedep ~liquid-bytestringnew-uploader

Dependencies added: filepath

Dependency ranges changed: base, liquid-base, liquid-bytestring, liquid-containers, liquid-fixpoint, liquid-prelude, liquid-vector, liquidhaskell

Files

liquid-platform.cabal view
@@ -1,6 +1,6 @@ cabal-version:      1.22 name:               liquid-platform-version:            0.8.10.2+version:            0.9.0.2 synopsis:           A battery-included platform for LiquidHaskell description:        A battery-included platform for LiquidHaskell. license:            BSD3@@ -25,31 +25,34 @@     buildable: False   else     buildable: True-    build-depends:      liquid-base       >= 4.14.1.0 && < 5-                      , liquid-containers >= 0.6.2.1  && < 0.7-                      , liquid-prelude    >= 0.8.10.2-                      , liquid-vector     >= 0.12.1.2 && < 0.13-                      , liquid-bytestring >= 0.10.0.0 && < 0.11-                      , liquidhaskell     >= 0.8.10.2+    build-depends:      liquid-base       >= 4.15.1.0 && < 5+                      , liquid-containers >= 0.6.4.1  && < 0.7+                      , liquid-prelude    >= 0.9.0.2+                      , liquid-vector     >= 0.12.3.1 && < 0.13+                      , liquid-bytestring >= 0.10.12.1 && < 0.11+                      , liquidhaskell     >= 0.9.0.2+                      , filepath                       , process           >= 1.6.0.0 && < 1.7                       , cmdargs           >= 0.10    && < 0.11    if flag(devel)     ghc-options: -Werror + executable gradual   main-is:          src/Gradual.hs-  build-depends:    base            >= 4.8.1.0 && < 5+  build-depends:    base            >= 4.15.1.0 && < 5                   , cmdargs                   , hscolour-                  , liquid-fixpoint >= 0.7.0.5-                  , liquidhaskell   >= 0.8.10.1+                  , liquid-fixpoint >= 0.9.0.2+                  , liquidhaskell   >= 0.9.0.2   default-language: Haskell2010   buildable:        False   ghc-options:      -W -threaded    if flag(devel)     ghc-options: -Werror+  executable target   main-is:          src/Target.hs
src/Liquid.hs view
@@ -1,14 +1,22 @@ {-# LANGUAGE LambdaCase #-} -{-| Calling LiquidHaskell via the source plugin.-  This executable is a simple wrapper around 'ghc', which gets passed an '-fplugin' option.--}+-- Calling LiquidHaskell via the source plugin+--+-- This executable is a wrapper around 'ghc', which gets passed an '-fplugin'+-- option. In addition, it hides all core libraries that might colide with a+-- package coming from liquid haskell.+--+-- The command line options of ghc and liquid haskell are merged together.+-- This script injects flags -fplugin-opt=LiquidHaskell:--opt for every+-- argument --opt intended for LiquidHaskell and occurring in the command line.  import Control.Monad -import System.Environment (lookupEnv, getArgs)+import System.Environment (lookupEnv, getArgs, unsetEnv)+import System.FilePath ((</>), takeDirectory, takeExtension) import System.Process import System.Exit+import Data.Char (toLower) import Data.Maybe import Data.Either (partitionEithers) import Data.Bifunctor@@ -38,6 +46,18 @@ helpNeeded :: [String] -> Bool helpNeeded = elem "--help" +collectPackageDbsFromGHC_ENVIRONMENT :: IO [FilePath]+collectPackageDbsFromGHC_ENVIRONMENT = do+  lookupEnv "GHC_ENVIRONMENT" >>= \case+    Nothing -> return []+    Just envFile -> do+      contents <- readFile envFile+      return+        [ takeDirectory envFile </> drop (length pfx) xs+        | xs <- lines contents+        , let pfx = "package-db "+        , isPrefixOf pfx xs+        ]  main :: IO a main = do@@ -50,18 +70,19 @@    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 (cliArgs, targets)    = partition (isPrefixOf "-") args+  let (targets, cliArgs)    =+        partition ((`elem` [".o", ".hs", ".lhs"]) . map toLower . takeExtension) args   let (ghcArgs, liquidArgs) = partitionArgs cliArgs -  -- NOTE: Typically for the executable we want to recompile everything-everytime so that-  -- we could always get an "answer" out of LH. However, using `-fforce-recomp` as the default-  -- is dangerous, because the executable is used also during tests, so runtime is going to be-  -- badly affected. If users wants to enable recompilation, they would simply pass-  -- '-fforce-recomp' as a CLI argument.--  let p = proc ghcPath $ [ "-O0"+  let p = proc ghcPath $+                         ["-package-env", "-"]+                         <> concat [ ["-package-db", p] | p <- packageDbs ]+                         <>+                         [ "-O0"                          , "-no-link"                          , "-fplugin=LiquidHaskell"                          , "-plugin-package", "liquidhaskell"@@ -87,4 +108,7 @@   _ <- getOpts (args \\ ghcArgs)   unless (helpNeeded args) printLiquidHaskellBanner +  -- Unset GHC_ENVIRONMENT so it doesn't influence ghc. Otherwise it would+  -- interfere when calling this program with cabal exec.+  unsetEnv "GHC_ENVIRONMENT"   withCreateProcess p $ \_mbStdIn _mbStdOut _mbStdErr pHandle -> waitForProcess pHandle >>= exitWith