1
1
mirror of https://github.com/tweag/asterius.git synced 2024-11-09 11:20:21 +03:00

Utilize new version of unliftio

This commit is contained in:
Shao Cheng 2018-03-14 15:28:05 +08:00
parent e0b856e974
commit 550614ad11
8 changed files with 24 additions and 23 deletions

View File

@ -5,10 +5,10 @@ import qualified Data.ByteString.Lazy as LBS
import Distribution.Simple.Compiler
import GHC
import System.Directory
import System.Environment.Blank
import System.IO
import System.Process
import UnliftIO.Exception
import System.IO (openBinaryTempFile)
import UnliftIO
import UnliftIO.Environment
import UnliftIO.Process
main :: IO ()
main = do
@ -44,6 +44,6 @@ main = do
(\(p, _) -> removeFile p) $ \(p, h) -> do
LBS.hPut h $ encode oa
hClose h
setEnv "ASTERIUS_ORIGINAL_ARGS_PATH" p True
setEnv "ASTERIUS_ORIGINAL_ARGS_PATH" p
callProcess ghc nargs
_ -> callProcess ghc nargs

View File

@ -39,7 +39,7 @@ dependencies:
- ghc
- hashable
- hbinaryen
- process
- pretty-show
- template-haskell
- unliftio
- unordered-containers

View File

@ -10,11 +10,11 @@ module Asterius.Boot
import Asterius.BuildInfo
import Data.List.Extra
import System.Directory
import System.Environment.Blank
import System.Exit
import System.FilePath.Posix
import System.Process
import UnliftIO.Exception
import UnliftIO
import UnliftIO.Environment
import UnliftIO.Process
data BootArgs = BootArgs
{ bootDir :: FilePath

View File

@ -22,8 +22,8 @@ import Name
import Outputable
import System.IO.Unsafe
dynFlagsRef :: IORef DynFlags
{-# NOINLINE dynFlagsRef #-}
dynFlagsRef :: IORef DynFlags
dynFlagsRef = unsafePerformIO $ newIORef unsafeGlobalDynFlags
setDynFlagsRef :: DynFlags -> IO ()
@ -67,7 +67,7 @@ deriving instance
deriving instance Show CmmTickScope
instance Show ModuleName where
show = fakeShow "ModuleName"
show = moduleNameString
deriving instance Show Module

View File

@ -14,7 +14,6 @@ import Asterius.Unexported
import Bindings.Binaryen.Raw
import Control.Monad
import Data.Binary
import Data.IORef
import Data.List.Extra
import qualified Data.Serialize.Cereal.Utils as C
import DriverPhases
@ -25,10 +24,10 @@ import Hooks
import PipelineMonad
import qualified Stream
import System.Directory
import System.Environment.Blank
import System.FilePath
import System.Process
import UnliftIO.Exception
import UnliftIO
import UnliftIO.Environment
import UnliftIO.Process
data OriginalArgs = OriginalArgs
{ args :: [String]
@ -65,7 +64,7 @@ frontendPlugin =
liftIO $ print c_BinaryenTypeInt64
OriginalArgs {..} <-
liftIO $ do
Just p <- getEnv "ASTERIUS_ORIGINAL_ARGS_PATH"
p <- getEnv "ASTERIUS_ORIGINAL_ARGS_PATH"
decodeFile p
if all isHaskellishTarget targets
then do
@ -73,7 +72,7 @@ frontendPlugin =
liftIO $ do
already_run_set_ref <- newIORef emptyModuleSet
obj_map_ref <- newIORef emptyModuleEnv
Just obj_topdir <- getEnv "ASTERIUS_LIB_DIR"
obj_topdir <- getEnv "ASTERIUS_LIB_DIR"
let obj_fn Module {..} =
obj_topdir </> unitIdString moduleUnitId </>
foldr1

View File

@ -1,12 +1,12 @@
import Asterius.BuildInfo
import System.Directory
import System.Environment.Blank
import System.FilePath
import System.Process
import UnliftIO.Environment
import UnliftIO.Process
main :: IO ()
main = do
pwd <- getCurrentDirectory
let test_path = pwd </> "test" </> "fact-dump"
setEnv "ASTERIUS_LIB_DIR" test_path True
setEnv "ASTERIUS_LIB_DIR" test_path
withCurrentDirectory test_path $ callProcess ahc ["--make", "fact.hs"]

View File

@ -8,9 +8,11 @@ extra-deps:
- cereal-0.5.5.0
- clock-0.7.2
- extra-1.6.4
- hashable-1.2.6.1
- hashable-1.2.7.0
- haskell-lexer-1.0.1
- pretty-show-1.7
- primitive-0.6.3.0
- unliftio-0.2.4.0
- unliftio-0.2.5.0
- unliftio-core-0.1.1.0
- unordered-containers-0.2.9.0
- vector-0.12.0.1

View File

@ -2,7 +2,7 @@
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -Wno-orphans #-}
{-# OPTIONS_GHC -Wno-orphans -Wno-unused-top-binds #-}
module Language.WebAssembly.IR
( ValueType(..)