summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCsaba Hruska <csaba.hruska@gmail.com>2017-05-29 14:23:37 +0100
committerCsaba Hruska <csaba.hruska@gmail.com>2017-05-29 14:23:37 +0100
commit1ab76c3545afab07cceee04bcfbec51d3c170e56 (patch)
tree9c073623ba3a67e830e1ecb3e37e96c2ba764f59
parentb869dce24bebb8d7fd505f8b11b18b5eea82dc77 (diff)
more typesig
-rw-r--r--src/LambdaCube/Compiler/DesugaredSource.hs9
-rw-r--r--src/LambdaCube/Compiler/Parser.hs4
-rw-r--r--src/LambdaCube/Compiler/Pretty.hs2
3 files changed, 11 insertions, 4 deletions
diff --git a/src/LambdaCube/Compiler/DesugaredSource.hs b/src/LambdaCube/Compiler/DesugaredSource.hs
index fef5a1d5..d355b4b9 100644
--- a/src/LambdaCube/Compiler/DesugaredSource.hs
+++ b/src/LambdaCube/Compiler/DesugaredSource.hs
@@ -164,7 +164,7 @@ pattern SIName_ :: SI -> Maybe Fixity -> SName -> SIName
164pattern SIName_ si f n <- SIName__ _ si f n 164pattern SIName_ si f n <- SIName__ _ si f n
165 where SIName_ si f n = SIName__ (fnameHash si n) si f n 165 where SIName_ si f n = SIName__ (fnameHash si n) si f n
166 166
167pattern SIName_ :: SI -> SName -> SIName 167pattern SIName :: SI -> SName -> SIName
168pattern SIName si n <- SIName_ si _ n 168pattern SIName si n <- SIName_ si _ n
169 where SIName si n = SIName_ si Nothing n 169 where SIName si n = SIName_ si Nothing n
170 170
@@ -220,8 +220,11 @@ data FNameTag
220 | Fparens | FtypeAnn | Fundefined | Fotherwise | FprimIfThenElse | FfromTo | FconcatMap | FfromInt | Fproject | Fswizzscalar | Fswizzvector 220 | Fparens | FtypeAnn | Fundefined | Fotherwise | FprimIfThenElse | FfromTo | FconcatMap | FfromInt | Fproject | Fswizzscalar | Fswizzvector
221 221
222 | FunsafeCoerce | FreflCstr | FhlistNilCase | FhlistConsCase 222 | FunsafeCoerce | FreflCstr | FhlistNilCase | FhlistConsCase
223 | FprimAddInt | FprimSubInt | FprimModInt | FprimSqrtFloat | FprimRound | FprimIntToFloat | FprimIntToNat | FprimCompareInt | FprimCompareFloat | FprimCompareChar | FprimCompareString 223 | FprimAddInt | FprimSubInt | FprimModInt | FprimSqrtFloat | FprimRound | FprimIntToFloat | FprimIntToNat
224 | FPrimGreaterThan | FPrimGreaterThanEqual | FPrimLessThan | FPrimLessThanEqual | FPrimEqualV | FPrimNotEqualV | FPrimEqual | FPrimNotEqual | FPrimSubS | FPrimSub | FPrimAddS | FPrimAdd | FPrimMulS | FPrimMul | FPrimDivS | FPrimDiv | FPrimModS | FPrimMod | FPrimNeg | FPrimAnd | FPrimOr | FPrimXor | FPrimNot 224 | FprimCompareInt | FprimCompareFloat | FprimCompareChar | FprimCompareString
225 | FPrimGreaterThan | FPrimGreaterThanEqual | FPrimLessThan | FPrimLessThanEqual | FPrimEqualV | FPrimNotEqualV | FPrimEqual | FPrimNotEqual
226 | FPrimSubS | FPrimSub | FPrimAddS | FPrimAdd | FPrimMulS | FPrimMul | FPrimDivS | FPrimDiv | FPrimModS | FPrimMod
227 | FPrimNeg | FPrimAnd | FPrimOr | FPrimXor | FPrimNot
225 228
226 -- other 229 -- other
227 | F_rhs | F_section 230 | F_rhs | F_section
diff --git a/src/LambdaCube/Compiler/Parser.hs b/src/LambdaCube/Compiler/Parser.hs
index 8db4b855..69f1b7a4 100644
--- a/src/LambdaCube/Compiler/Parser.hs
+++ b/src/LambdaCube/Compiler/Parser.hs
@@ -76,6 +76,7 @@ instance PShow ParseWarning where
76 addG x [] = x 76 addG x [] = x
77 addG x xs = DOp "|" (Infix (-5)) x $ foldr1 (DOp "," (InfixR (-4))) xs 77 addG x xs = DOp "|" (Infix (-5)) x $ foldr1 (DOp "," (InfixR (-4))) xs
78 78
79trackSI :: SourceInfo a => BodyParser a -> BodyParser a
79trackSI p = do 80trackSI p = do
80 x <- p 81 x <- p
81 tell $ Right . TrackedCode <$> maybeToList (getRange $ sourceInfo x) 82 tell $ Right . TrackedCode <$> maybeToList (getRange $ sourceInfo x)
@@ -387,6 +388,7 @@ checkPattern ns = tell $ pure $ Left $
387 [] -> Nothing 388 [] -> Nothing
388 xs -> Just $ MultiplePatternVars xs 389 xs -> Just $ MultiplePatternVars xs
389 390
391--postponedCheck :: _
390postponedCheck pr x = do 392postponedCheck pr x = do
391 tell [Left $ either (\(a, b) -> Just $ OperatorMismatch (pr a) (pr b)) (const Nothing) x] 393 tell [Left $ either (\(a, b) -> Just $ OperatorMismatch (pr a) (pr b)) (const Nothing) x]
392 return $ either (const $ error "impossible @ Parser 725") id x 394 return $ either (const $ error "impossible @ Parser 725") id x
@@ -485,6 +487,7 @@ parseRHS tok = do
485 487
486parseDefs lhs = identation True parseDef >>= runCheck . compileStmt'_ lhs SRHS SRHS . concat 488parseDefs lhs = identation True parseDef >>= runCheck . compileStmt'_ lhs SRHS SRHS . concat
487 489
490--funAltDef :: BodyParser _ -> BodyParser _ -> BodyParser _
488funAltDef parseOpName parseName = do 491funAltDef parseOpName parseName = do
489 (n, (fee, tss)) <- 492 (n, (fee, tss)) <-
490 case parseOpName of 493 case parseOpName of
@@ -512,6 +515,7 @@ parseExport =
512 ExportModule <$ reserved "module" <*> moduleName 515 ExportModule <$ reserved "module" <*> moduleName
513 <|> ExportId <$> varId 516 <|> ExportId <$> varId
514 517
518importlist :: HeaderParser [SIName]
515importlist = parens $ commaSep upperLower 519importlist = parens $ commaSep upperLower
516 520
517parseExtensions :: HeaderParser [Extension] 521parseExtensions :: HeaderParser [Extension]
diff --git a/src/LambdaCube/Compiler/Pretty.hs b/src/LambdaCube/Compiler/Pretty.hs
index a82f7ce6..05fdd096 100644
--- a/src/LambdaCube/Compiler/Pretty.hs
+++ b/src/LambdaCube/Compiler/Pretty.hs
@@ -28,7 +28,7 @@ import Debug.Trace
28 28
29import qualified Text.PrettyPrint.ANSI.Leijen as P 29import qualified Text.PrettyPrint.ANSI.Leijen as P
30 30
31import LambdaCube.Compiler.Utils 31import LambdaCube.Compiler.Utils(dropIndex, Void, elimVoid)
32 32
33-------------------------------------------------------------------------------- fixity 33-------------------------------------------------------------------------------- fixity
34 34