aboutsummaryrefslogtreecommitdiffstats
path: root/test/TestUtils.hs
blob: 478d92391386f6822d5595e896d874440fd33eff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{-# OPTIONS_GHC -Wno-missing-export-lists #-}
module TestUtils where

import Control.Monad.Except
import Control.Monad.Reader
import Utils

initialConfig :: Config
initialConfig = Config {
    configScriptFileName = Nothing,
    configVerboseMode = False,
    configShowHelp = False
}

runLContext :: LContext a -> IO a
runLContext lc = do res <- runExceptT $ runReaderT lc initialConfig
                    case res of
                        Left (LException err) -> error err
                        Right val -> return val