diff options
author | Daniel Gröber <dxld@darkboxed.org> | 2017-09-18 01:23:22 +0200 |
---|---|---|
committer | Daniel Gröber <dxld@darkboxed.org> | 2017-09-18 01:35:40 +0200 |
commit | f864a5eae8262752162c6b0d124aea4601ed9ac1 (patch) | |
tree | 1b765d25741b6e47d4ad458c8041c0881dd353b8 /CabalHelper/Compiletime/Log.hs | |
parent | 70d743eb6a8b7f8da182524fa0b2c4bf02399d50 (diff) |
Fix literally everything :)
Sorry for the megacommit
- Seperate modules into:
- Compiletime, modules which are only used while building the package
- Runtime, modues included in the wrapper binary to be compiled on the
users machine at runtime
- Shared, modues used in both contexts
- Refactor runtime compilation
- Completely revamp output paths
- Don't chdir when invoking ghc
- Require cabal-version 1.14 in cabal file
Diffstat (limited to 'CabalHelper/Compiletime/Log.hs')
-rw-r--r-- | CabalHelper/Compiletime/Log.hs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/CabalHelper/Compiletime/Log.hs b/CabalHelper/Compiletime/Log.hs new file mode 100644 index 0000000..e4033f1 --- /dev/null +++ b/CabalHelper/Compiletime/Log.hs @@ -0,0 +1,21 @@ +module CabalHelper.Compiletime.Log where + +import Control.Monad +import Control.Monad.IO.Class +import Control.Exception as E +import Data.String +import System.IO +import Prelude + +import CabalHelper.Shared.Types + +vLog :: MonadIO m => Options -> String -> m () +vLog Options { verbose = True } msg = + liftIO $ hPutStrLn stderr msg +vLog _ _ = return () + +logSomeError :: Options -> String -> IO (Maybe a) -> IO (Maybe a) +logSomeError opts label a = do + a `E.catch` \se@(SomeException _) -> do + vLog opts $ label ++ ": " ++ show se + return Nothing |