diff options
author | Péter Diviánszky <divipp@gmail.com> | 2016-01-09 13:31:20 +0100 |
---|---|---|
committer | Péter Diviánszky <divipp@gmail.com> | 2016-01-09 13:31:20 +0100 |
commit | c9373d5b6173c641434e3fa7c53f09b3b88d9161 (patch) | |
tree | 69f7a4583afd205a814cd8bf4a2c8424dd58925d /src | |
parent | 938bbdd8077e9f22b047b84a2209f55f737790f3 (diff) |
refactoring
Diffstat (limited to 'src')
-rw-r--r-- | src/LambdaCube/Compiler/CGExp.hs | 6 | ||||
-rw-r--r-- | src/LambdaCube/Compiler/Driver.hs | 6 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/LambdaCube/Compiler/CGExp.hs b/src/LambdaCube/Compiler/CGExp.hs index 21a02e8d..b2f19c9f 100644 --- a/src/LambdaCube/Compiler/CGExp.hs +++ b/src/LambdaCube/Compiler/CGExp.hs | |||
@@ -214,7 +214,7 @@ pattern TCon0 n = A0 n | |||
214 | pattern TCon t n = Con (n, t) [] | 214 | pattern TCon t n = Con (n, t) [] |
215 | 215 | ||
216 | pattern TUnit <- A0 "Tuple0" | 216 | pattern TUnit <- A0 "Tuple0" |
217 | pattern TBool <- A0 "Bool" | 217 | pattern TBool = A0 "Bool" |
218 | pattern TWord <- A0 "Word" | 218 | pattern TWord <- A0 "Word" |
219 | pattern TInt <- A0 "Int" | 219 | pattern TInt <- A0 "Int" |
220 | pattern TNat = A0 "Nat" | 220 | pattern TNat = A0 "Nat" |
@@ -270,3 +270,7 @@ getSwizzChar = \case | |||
270 | A0 "Sw" -> Just 'w' | 270 | A0 "Sw" -> Just 'w' |
271 | _ -> Nothing | 271 | _ -> Nothing |
272 | 272 | ||
273 | outputType = TCon0 "Output" | ||
274 | boolType = TBool | ||
275 | trueExp = TCon TBool "True" | ||
276 | |||
diff --git a/src/LambdaCube/Compiler/Driver.hs b/src/LambdaCube/Compiler/Driver.hs index 46b25148..68ec34dd 100644 --- a/src/LambdaCube/Compiler/Driver.hs +++ b/src/LambdaCube/Compiler/Driver.hs | |||
@@ -11,6 +11,7 @@ module LambdaCube.Compiler.Driver | |||
11 | , Infos | 11 | , Infos |
12 | , showRange | 12 | , showRange |
13 | , ErrorMsg(..) | 13 | , ErrorMsg(..) |
14 | , Exp | ||
14 | ) where | 15 | ) where |
15 | 16 | ||
16 | import Data.List | 17 | import Data.List |
@@ -32,7 +33,7 @@ import Debug.Trace | |||
32 | 33 | ||
33 | import LambdaCube.Compiler.Pretty hiding ((</>)) | 34 | import LambdaCube.Compiler.Pretty hiding ((</>)) |
34 | import LambdaCube.Compiler.Infer (Info, Infos, ErrorMsg(..), showRange, PolyEnv(..), Export(..), ModuleR(..), ErrorT, throwErrorTCM, parseLC, joinPolyEnvs, inference_) | 35 | import LambdaCube.Compiler.Infer (Info, Infos, ErrorMsg(..), showRange, PolyEnv(..), Export(..), ModuleR(..), ErrorT, throwErrorTCM, parseLC, joinPolyEnvs, inference_) |
35 | import LambdaCube.Compiler.CGExp | 36 | import LambdaCube.Compiler.CGExp (Exp, toExp, outputType) |
36 | import IR | 37 | import IR |
37 | import qualified LambdaCube.Compiler.CoreToIR as IR | 38 | import qualified LambdaCube.Compiler.CoreToIR as IR |
38 | 39 | ||
@@ -147,9 +148,6 @@ getDef m d ty = do | |||
147 | , infos pe | 148 | , infos pe |
148 | ) | 149 | ) |
149 | 150 | ||
150 | outputType :: Exp | ||
151 | outputType = TCon TType "Output" | ||
152 | |||
153 | parseAndToCoreMain m = either (throwErrorTCM . text) return . (\(e, i) -> flip (,) i <$> e) =<< getDef m "main" (Just outputType) | 151 | parseAndToCoreMain m = either (throwErrorTCM . text) return . (\(e, i) -> flip (,) i <$> e) =<< getDef m "main" (Just outputType) |
154 | 152 | ||
155 | compileMain_ :: MonadMask m => PolyEnv -> ModuleFetcher (MMT m) -> IR.Backend -> FilePath -> MName -> m (Err (IR.Pipeline, Infos)) | 153 | compileMain_ :: MonadMask m => PolyEnv -> ModuleFetcher (MMT m) -> IR.Backend -> FilePath -> MName -> m (Err (IR.Pipeline, Infos)) |