forked from chrisdone-archive/tryhaskell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Imports.hs
58 lines (56 loc) · 1.96 KB
/
Imports.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
module Imports where
import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.Cont
import Control.Monad.Error
import Control.Monad.Fix
import Control.Monad.Identity
import Control.Monad.RWS
import Control.Monad.Reader
import Control.Monad.State
import Control.Monad.Writer
import Data.Array
import Data.Bits
import Data.Bool
import Data.Char
import Data.Complex
import Data.Dynamic
import Data.Either
import Data.Eq
import Data.Fixed
import Data.Function
import Data.Graph
import Data.Int
import Data.Ix
import Data.List
import qualified Data.Map as M
import Data.Maybe
import Data.Monoid
import Data.Ord
import Data.Ratio
import Data.Tree
import Data.Tuple
import Data.Typeable
import Data.Word
import Debug.SimpleReflect
import Prelude hiding (IO,putStr,putStrLn,getLine,readLn,print,readIO,readFile,writeFile,appendFile)
import PureIO as IO
import ShowFun
import System.Random
import Test.QuickCheck
import Text.JSON
import Text.PrettyPrint.HughesPJ
import Text.Printf
-- | Run the given command and then show the output. This constraint
-- is to aid communication between mueval and tryhaskell.
runTryHaskellIO :: (Read b,Show b)
=> ([String],[(FilePath,String)])
-> IO b
-> Either (Interrupt,([String],[(FilePath,String)]))
(String,([String],[(FilePath,String)]))
runTryHaskellIO (is,fs) m =
case runIO (Input is (M.fromList fs)) m of
(Left i,out) -> Left (i,convert out)
(Right r,out) -> Right (show r,convert out)
where convert (Output os fs) = (os,M.toList fs)