Skip to content

Commit

Permalink
Initial work to support the new executable
Browse files Browse the repository at this point in the history
  • Loading branch information
adinapoli committed May 18, 2020
1 parent 30f56bb commit e8f2878
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 10 deletions.
2 changes: 0 additions & 2 deletions liquid-base/liquid-base.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ data-files: src/Data/*.spec
src/Liquid/Prelude/*.spec
src/Foreign/C/*.spec
src/Foreign/*.spec
src/Debug/Trace.spec
src/Control/*.spec
src/Control/Exception/*.spec

library
exposed-modules: Control.Applicative
Expand Down
5 changes: 1 addition & 4 deletions liquid-ghc-prim/liquid-ghc-prim.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ homepage: https://github.com/ucsd-progsys/liquidhaskell
build-type: Simple
cabal-version: >= 1.22

data-files: src/GHC/Types.spec
src/GHC/CString.spec
src/GHC/Classes.spec
src/GHC/Prim.spec
data-files: src/GHC/*.spec

library
exposed-modules: GHC.Prim
Expand Down
18 changes: 18 additions & 0 deletions liquidhaskell.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,24 @@ library

executable liquid
main-is: src/Liquid.hs
build-depends: base >= 4.9.1.0 && < 5
, liquidhaskell
, process
default-language: Haskell98
default-extensions: PatternGuards
ghc-options: -W -threaded -fdefer-typed-holes

if flag(devel)
ghc-options: -Werror

if impl(ghc >= 8.10)
buildable: True
else
buildable: False

-- This is the (legacy and deprecated) 'liquid' executable which uses the old GHC Interface.
executable liquid-legacy
main-is: src/LiquidLegacy.hs
build-depends: base >= 4.9.1.0 && < 5, liquidhaskell
default-language: Haskell98
default-extensions: PatternGuards
Expand Down
27 changes: 23 additions & 4 deletions src/Liquid.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
import Language.Haskell.Liquid.Liquid (liquid)
import System.Environment (getArgs)
-- import GhcTest

{-| Calling LiquidHaskell via the source plugin.
This executable is a simple wrapper around 'ghc', which will be called with LiquidHaskell source plugin.
-}

import System.Environment (lookupEnv, getArgs)
import System.Process
import System.Exit
import Data.Maybe

main :: IO a
main = liquid =<< getArgs
main = do
args <- getArgs
ghcPath <- fromMaybe "ghc" <$> lookupEnv "LIQUID_GHC_PATH"

let p = proc ghcPath $ [ "-O0"
, "--make"
, "-no-link"
, "-fplugin=Language.Haskell.Liquid.GHC.Plugin"
, "-plugin-package", "liquidhaskell"
, "-package", "liquid-base"
, "-hide-package", "base"
] <> args

withCreateProcess p $ \_mbStdIn _mbStdOut _mbStdErr pHandle -> waitForProcess pHandle >>= exitWith
6 changes: 6 additions & 0 deletions src/LiquidLegacy.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Language.Haskell.Liquid.Liquid (liquid)
import System.Environment (getArgs)
-- import GhcTest

main :: IO a
main = liquid =<< getArgs
7 changes: 7 additions & 0 deletions stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ ghc-options:
allow-newer: true # 8.10.1
packages:
- liquid-fixpoint
- liquid-ghc-prim
- liquid-base
- liquid-bytestring
- liquid-prelude
- liquid-vector
- liquid-containers
- liquid-parallel
- .
extra-deps:
- tasty-rerun-1.1.14
Expand Down

0 comments on commit e8f2878

Please sign in to comment.