summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPéter Diviánszky <divipp@gmail.com>2016-02-05 12:30:59 +0100
committerPéter Diviánszky <divipp@gmail.com>2016-02-05 12:31:36 +0100
commit23c96a164632c6f7085ee19b086bbb17014d834a (patch)
treeb71a6986cf5bc09310ed35eeb2e26802f99d5718
parentd4ba9e18595b968a4a4c26645cb2dddcefd15420 (diff)
try to switch to megaparsec
-rw-r--r--lc/Internals.lc1
-rw-r--r--src/LambdaCube/Compiler/Lexer.hs87
-rw-r--r--src/LambdaCube/Compiler/Parser.hs82
-rw-r--r--testdata/Internals.out566
4 files changed, 390 insertions, 346 deletions
diff --git a/lc/Internals.lc b/lc/Internals.lc
index 92d66d2f..e0639717 100644
--- a/lc/Internals.lc
+++ b/lc/Internals.lc
@@ -21,7 +21,6 @@ data Tuple3 a b c = Tuple3 a b c
21data Tuple4 a b c d = Tuple4 a b c d 21data Tuple4 a b c d = Tuple4 a b c d
22data Tuple5 a b c d e = Tuple5 a b c d e 22data Tuple5 a b c d e = Tuple5 a b c d e
23 23
24
25-- ... TODO 24-- ... TODO
26 25
27-- builtin used for overlapping instances 26-- builtin used for overlapping instances
diff --git a/src/LambdaCube/Compiler/Lexer.hs b/src/LambdaCube/Compiler/Lexer.hs
index 9e5e77c1..7bb9b2f0 100644
--- a/src/LambdaCube/Compiler/Lexer.hs
+++ b/src/LambdaCube/Compiler/Lexer.hs
@@ -9,7 +9,10 @@
9{-# LANGUAGE ScopedTypeVariables #-} 9{-# LANGUAGE ScopedTypeVariables #-}
10{-# OPTIONS_GHC -fno-warn-orphans #-} -- instance NFData SourcePos 10{-# OPTIONS_GHC -fno-warn-orphans #-} -- instance NFData SourcePos
11{-# OPTIONS -fno-warn-unused-do-bind -fno-warn-name-shadowing #-} 11{-# OPTIONS -fno-warn-unused-do-bind -fno-warn-name-shadowing #-}
12module LambdaCube.Compiler.Lexer where 12module LambdaCube.Compiler.Lexer
13 ( module LambdaCube.Compiler.Lexer
14 , module Pr
15 ) where
13 16
14import Data.Monoid 17import Data.Monoid
15import Data.Maybe 18import Data.Maybe
@@ -25,22 +28,86 @@ import Control.Arrow hiding ((<+>))
25import Control.Applicative 28import Control.Applicative
26import Control.DeepSeq 29import Control.DeepSeq
27 30
31import LambdaCube.Compiler.Pretty hiding (Doc, braces, parens)
32
33--------------------- parsec specific code begins here
28import Text.Parsec hiding ((<|>), many) 34import Text.Parsec hiding ((<|>), many)
35import Text.Parsec as Pr hiding (label, Empty, State, (<|>), many, try)
36import qualified Text.Parsec as Pa
29import Text.Parsec.Indentation as Pa 37import Text.Parsec.Indentation as Pa
30import Text.Parsec.Indentation.Char 38import Text.Parsec.Indentation.Char
39import Text.Parsec.Pos
31 40
32import LambdaCube.Compiler.Pretty hiding (Doc, braces, parens) 41skipSome = skipMany1
42
43type P = ParsecT (IndentStream (CharIndentStream String)) SourcePos InnerP
44
45indent s p = reserved s *> localIndentation Ge (localAbsoluteIndentation p)
46indented = localIndentation Gt
47indentMany s p = indent s $ many p
48indentSome s p = indent s $ some p
49indentMany' = many
50
51whiteSpace = ignoreAbsoluteIndentation (localTokenMode (const Pa.Any) whiteSpace')
52
53lexeme p
54 = p <* (getPosition >>= setState >> whiteSpace)
55
56mkStream = mkIndentStream 0 infIndentation True Ge . mkCharIndentStream
57
58runPT' p st --u name s
59 = do res <- runParsecT p st -- (Pa.State s (initialPos name) u)
60 r <- parserReply res
61 case r of
62 Ok x _ _ -> return (Right x)
63 Error err -> return (Left err)
64 where
65 parserReply res
66 = case res of
67 Consumed r -> r
68 Pa.Empty r -> r
69
70runParserT'' p f = runParserT p (initialPos f) f
71--------------------- parsec specific code ends here
33{- 72{-
73--------------------- megaparsec specific code begins here
74import Control.Monad.State
34import Text.Megaparsec 75import Text.Megaparsec
76import Text.Megaparsec.Lexer hiding (lexeme, symbol, space, negate)
77import Text.Megaparsec as Pr hiding (try, label, Message)
78import Text.Megaparsec.Pos
79
80optionMaybe = optional
81runParserT'' p f = flip evalStateT (initialPos f, 0) . runParserT p f
82
83runPT' p st = snd <$> flip evalStateT (initialPos ".....", 0) (runParserT' p st)
84mkStream = id
35hexDigit = hexDigitChar 85hexDigit = hexDigitChar
36octDigit = octDigitChar 86octDigit = octDigitChar
37digit = digitChar 87digit = digitChar
88getState = fst <$> get
89
90type P = ParsecT String (StateT (SourcePos, Int) InnerP)
91
92indentMany' p = --many p--
93 indentBlock whiteSpace' $ whiteSpace' >> return (IndentMany Nothing return p)
94indentMany s p = indentBlock whiteSpace' $ try (reserved s) *> return (IndentMany Nothing return p)
95indentSome s p = indentBlock whiteSpace' $ try (reserved s) *> return (IndentSome Nothing return p)
96indented p = do
97 i <- indentLevel
98 modify $ second $ const i
99 --p <* indentGuard whiteSpace' (>= i)
100 p
101
102lexeme p = do
103 i <- indentLevel
104 i' <- snd <$> get
105-- when (i < i') $ fail "indent level"
106 p <* (getPosition >>= \p -> modify (first $ const p) >> whiteSpace)
107
108whiteSpace = whiteSpace'
109--------------------- megaparsec specific code ends here
38-} 110-}
39skipSome = skipMany1
40
41indent s p = reserved s *> localIndentation Ge (localAbsoluteIndentation p)
42indented = localIndentation Gt
43
44-------------------------------------------------------------------------------- parser utils 111-------------------------------------------------------------------------------- parser utils
45 112
46-- see http://blog.ezyang.com/2014/05/parsec-try-a-or-b-considered-harmful/comment-page-1/#comment-6602 113-- see http://blog.ezyang.com/2014/05/parsec-try-a-or-b-considered-harmful/comment-page-1/#comment-6602
@@ -53,7 +120,6 @@ manyNM k n p = (:) <$> p <*> manyNM (k-1) (n-1) p
53 120
54-------------------------------------------------------------------------------- parser type 121-------------------------------------------------------------------------------- parser type
55 122
56type P = ParsecT (IndentStream (CharIndentStream String)) SourcePos InnerP
57type InnerP = WriterT [PostponedCheck] (Reader (DesugarInfo, Namespace)) 123type InnerP = WriterT [PostponedCheck] (Reader (DesugarInfo, Namespace))
58 124
59type PostponedCheck = Maybe String 125type PostponedCheck = Maybe String
@@ -371,7 +437,7 @@ parseLit = lexeme $ charLiteral <|> stringLiteral <|> natFloat
371 <?> "escape code" 437 <?> "escape code"
372 438
373 charControl = do{ char '^' 439 charControl = do{ char '^'
374 ; code <- upper 440 ; code <- satisfy isUpper <?> "uppercase letter"
375 ; return (toEnum (fromEnum code - fromEnum 'A')) 441 ; return (toEnum (fromEnum code - fromEnum 'A'))
376 } 442 }
377 443
@@ -524,13 +590,10 @@ theReservedNames = Set.fromList $
524----------------------------------------------------------- 590-----------------------------------------------------------
525-- White space & symbols 591-- White space & symbols
526----------------------------------------------------------- 592-----------------------------------------------------------
527lexeme p
528 = p <* (getPosition >>= setState >> whiteSpace)
529 593
530symbol name 594symbol name
531 = lexeme (string name) 595 = lexeme (string name)
532 596
533whiteSpace = ignoreAbsoluteIndentation (localTokenMode (const Pa.Any) whiteSpace')
534whiteSpace' = skipMany (simpleSpace <|> oneLineComment <|> multiLineComment <?> "") 597whiteSpace' = skipMany (simpleSpace <|> oneLineComment <|> multiLineComment <?> "")
535 598
536simpleSpace 599simpleSpace
diff --git a/src/LambdaCube/Compiler/Parser.hs b/src/LambdaCube/Compiler/Parser.hs
index 59a2db04..b1e149b1 100644
--- a/src/LambdaCube/Compiler/Parser.hs
+++ b/src/LambdaCube/Compiler/Parser.hs
@@ -8,18 +8,23 @@
8{-# LANGUAGE DeriveFunctor #-} 8{-# LANGUAGE DeriveFunctor #-}
9{-# LANGUAGE ScopedTypeVariables #-} 9{-# LANGUAGE ScopedTypeVariables #-}
10module LambdaCube.Compiler.Parser 10module LambdaCube.Compiler.Parser
11 {- todo ( definitions 11 ( SData(..)
12 , extensions
13 , SData(..)
14 , NameDB, caseName, pattern MatchName 12 , NameDB, caseName, pattern MatchName
15 , sourceInfo, SI(..), debugSI 13 , sourceInfo, SI(..), debugSI
16 , Module(..), Visibility(..), Binder(..), SExp'(..), Extension(..), Extensions 14 , Module(..), Visibility(..), Binder(..), SExp'(..), Extension(..), Extensions
17 , pattern SVar, pattern SType, pattern Wildcard, pattern SAppV, pattern SLamV, pattern SAnn 15 , pattern SVar, pattern SType, pattern Wildcard, pattern SAppV, pattern SLamV, pattern SAnn
18 , getParamsS, addParamsS, getApps, apps', downToS, used, addForalls 16 , pattern SBuiltin, pattern SPi, pattern Primitive, pattern SLabelEnd, pattern SLam
17 , pattern TyType, pattern Wildcard_
18 , debug, LI, isPi, varDB, lowerDB, MaxDB (..), iterateN, traceD, parseLC
19 , getParamsS, addParamsS, getApps, apps', downToS, addForalls
19 , mkDesugarInfo, joinDesugarInfo 20 , mkDesugarInfo, joinDesugarInfo
20 , throwErrorTCM, ErrorMsg(..), ErrorT 21 , throwErrorTCM, ErrorMsg(..), ErrorT
21 , Doc, shLam, shApp, shLet, shLet_, shAtom, shAnn, shVar, epar, showDoc, showDoc_, sExpDoc 22 , Up (..), up1, up
22 ) -} where 23 , Doc, shLam, shApp, shLet, shLet_, shAtom, shAnn, shVar, epar, showDoc, showDoc_, sExpDoc, shCstr
24 , mtrace, sortDefs
25 , trSExp', usedS, substSG0, substS
26 , Stmt (..), Export (..), ImportItems (..)
27 ) where
23 28
24import Data.Monoid 29import Data.Monoid
25import Data.Maybe 30import Data.Maybe
@@ -36,12 +41,6 @@ import Control.Monad.State
36import Control.Arrow hiding ((<+>)) 41import Control.Arrow hiding ((<+>))
37import Control.Applicative 42import Control.Applicative
38 43
39import Text.Parsec hiding (label, Empty, State, (<|>), many, try)
40import qualified Text.Parsec as Pa
41import Text.Parsec.Pos
42import Text.Parsec.Indentation hiding (Any)
43import Text.Parsec.Indentation.Char
44
45import qualified LambdaCube.Compiler.Pretty as P 44import qualified LambdaCube.Compiler.Pretty as P
46import LambdaCube.Compiler.Pretty hiding (Doc, braces, parens) 45import LambdaCube.Compiler.Pretty hiding (Doc, braces, parens)
47import LambdaCube.Compiler.Lexer 46import LambdaCube.Compiler.Lexer
@@ -200,7 +199,7 @@ instance Show MaxDB where show _ = "MaxDB"
200varDB i = MaxDB $ Just $ i + 1 199varDB i = MaxDB $ Just $ i + 1
201 200
202lowerDB (MaxDB i) = MaxDB $ (+ (- 1)) <$> i 201lowerDB (MaxDB i) = MaxDB $ (+ (- 1)) <$> i
203lowerDB' l (MaxDB i) = MaxDB $ Just $ 1 + max l (fromMaybe 0 i) 202--lowerDB' l (MaxDB i) = MaxDB $ Just $ 1 + max l (fromMaybe 0 i)
204 203
205class Up a where 204class Up a where
206 up_ :: Int -> Int -> a -> a 205 up_ :: Int -> Int -> a -> a
@@ -275,9 +274,6 @@ substS'' j' x = mapS' f2 (+1) j'
275substSG j = mapS__ (\_ _ _ -> error "substSG") (\sn x -> if sn == j then SVar sn x else SGlobal sn) (\sn j -> const $ SVar sn j) (+1) 274substSG j = mapS__ (\_ _ _ -> error "substSG") (\sn x -> if sn == j then SVar sn x else SGlobal sn) (\sn j -> const $ SVar sn j) (+1)
276substSG0 n = substSG n 0 . up1 275substSG0 n = substSG n 0 . up1
277 276
278downS n x | usedS n x = Nothing
279 | otherwise = Just x -- $ substS'' t (error "impossible") x
280
281instance Up Void where 277instance Up Void where
282 up_ n i = error "up_ @Void" 278 up_ n i = error "up_ @Void"
283 fold _ = error "fold_ @Void" 279 fold _ = error "fold_ @Void"
@@ -351,9 +347,9 @@ parseTerm prec = withRange setSI $ case prec of
351 checkPattern fe 347 checkPattern fe
352 t' <- dbf' fe <$> parseTerm PrecLam 348 t' <- dbf' fe <$> parseTerm PrecLam
353 ge <- dsInfo 349 ge <- dsInfo
354 return $ foldr (uncurry (patLam_ id ge)) t' ts 350 return $ foldr (uncurry (patLam id ge)) t' ts
355 <|> compileCase <$ reserved "case" <*> dsInfo <*> parseETerm PrecLam <*> do 351 <|> compileCase <$ reserved "case" <*> dsInfo <*> parseETerm PrecLam <*> do
356 indent "of" $ some $ do 352 indentSome "of" $ do
357 (fe, p) <- longPattern 353 (fe, p) <- longPattern
358 (,) p <$> parseRHS (dbf' fe) "->" 354 (,) p <$> parseRHS (dbf' fe) "->"
359-- <|> compileGuardTree id id <$> dsInfo <*> (Alts <$> parseSomeGuards (const True)) 355-- <|> compileGuardTree id id <$> dsInfo <*> (Alts <$> parseSomeGuards (const True))
@@ -381,7 +377,7 @@ parseTerm prec = withRange setSI $ case prec of
381 ) <|> mkList <$> namespace <*> pure []) 377 ) <|> mkList <$> namespace <*> pure [])
382 <|> mkTuple <$> namespace <*> parens (commaSep $ parseTerm PrecLam) 378 <|> mkTuple <$> namespace <*> parens (commaSep $ parseTerm PrecLam)
383 <|> mkRecord <$> braces (commaSep $ (,) <$> lowerCase <* symbol ":" <*> parseTerm PrecLam) 379 <|> mkRecord <$> braces (commaSep $ (,) <$> lowerCase <* symbol ":" <*> parseTerm PrecLam)
384 <|> mkLets True <$> dsInfo <*> indent "let" (parseDefs xSLabelEnd) <* reserved "in" <*> parseTerm PrecLam 380 <|> mkLets True <$> dsInfo <*> parseDefs xSLabelEnd (indentMany "let") <* reserved "in" <*> parseTerm PrecLam
385 where 381 where
386 level pr f = parseTerm pr >>= \t -> option t $ f t 382 level pr f = parseTerm pr >>= \t -> option t $ f t
387 383
@@ -481,10 +477,8 @@ getTTuple (SAppV (getTTuple -> Just (n, xs)) z) = Just (n, xs ++ [z]{-todo: eff-
481getTTuple (SGlobal (si, s@(splitAt 6 -> ("'Tuple", reads -> [(n, "")])))) = Just (n :: Int, []) 477getTTuple (SGlobal (si, s@(splitAt 6 -> ("'Tuple", reads -> [(n, "")])))) = Just (n :: Int, [])
482getTTuple _ = Nothing 478getTTuple _ = Nothing
483 479
484patLam f ge = patLam_ f ge (Visible, Wildcard SType) 480patLam :: (SExp -> SExp) -> DesugarInfo -> (Visibility, SExp) -> Pat -> SExp -> SExp
485 481patLam f ge (v, t) p e = SLam v t $ compileGuardTree f f ge $ compilePatts [(p, 0)] $ Right e
486patLam_ :: (SExp -> SExp) -> DesugarInfo -> (Visibility, SExp) -> Pat -> SExp -> SExp
487patLam_ f ge (v, t) p e = SLam v t $ compileGuardTree f f ge $ compilePatts [(p, 0)] $ Right e
488 482
489-------------------------------------------------------------------------------- pattern representation 483-------------------------------------------------------------------------------- pattern representation
490 484
@@ -509,7 +503,7 @@ mapP f = \case
509 ViewPat e pp -> ViewPat (f e) (mapPP f pp) 503 ViewPat e pp -> ViewPat (f e) (mapPP f pp)
510 PatType pp e -> PatType (mapPP f pp) (f e) 504 PatType pp e -> PatType (mapPP f pp) (f e)
511 505
512upP i j = mapP (up_ j i) 506--upP i j = mapP (up_ j i)
513 507
514varPP = length . getPPVars_ 508varPP = length . getPPVars_
515varP = length . getPVars_ 509varP = length . getPVars_
@@ -593,7 +587,7 @@ parsePat = \case
593 calculatePatPrecs dcls (e, xs) = calcPrec (\op x y -> PCon op $ ParPat . (:[]) <$> [x, y]) (getFixity dcls . snd) e xs 587 calculatePatPrecs dcls (e, xs) = calcPrec (\op x y -> PCon op $ ParPat . (:[]) <$> [x, y]) (getFixity dcls . snd) e xs
594 588
595longPattern = parsePat PrecAnn <&> (getPVars &&& id) 589longPattern = parsePat PrecAnn <&> (getPVars &&& id)
596patternAtom = parsePat PrecAtom <&> (getPVars &&& id) 590--patternAtom = parsePat PrecAtom <&> (getPVars &&& id)
597 591
598telescopePat = fmap (getPPVars . ParPat . map snd &&& id) $ many $ uncurry f <$> hiddenTerm (parsePat PrecAtom) (parsePat PrecAtom) 592telescopePat = fmap (getPPVars . ParPat . map snd &&& id) $ many $ uncurry f <$> hiddenTerm (parsePat PrecAtom) (parsePat PrecAtom)
599 where 593 where
@@ -627,10 +621,10 @@ mapGT k i = \case
627upGT k i = mapGT k $ \k -> up_ i k 621upGT k i = mapGT k $ \k -> up_ i k
628 622
629substGT i j = mapGT 0 $ \k -> rearrangeS $ \r -> if r == k + i then k + j else if r > k + i then r - 1 else r 623substGT i j = mapGT 0 $ \k -> rearrangeS $ \r -> if r == k + i then k + j else if r > k + i then r - 1 else r
630 624{-
631dbfGT :: DBNames -> GuardTree -> GuardTree 625dbfGT :: DBNames -> GuardTree -> GuardTree
632dbfGT v = mapGT 0 $ \k -> dbf_ k v 626dbfGT v = mapGT 0 $ \k -> dbf_ k v
633 627-}
634-- todo: clenup 628-- todo: clenup
635compilePatts :: [(Pat, Int)] -> Either [(SExp, SExp)] SExp -> GuardTree 629compilePatts :: [(Pat, Int)] -> Either [(SExp, SExp)] SExp -> GuardTree
636compilePatts ps gu = cp [] ps 630compilePatts ps gu = cp [] ps
@@ -758,7 +752,7 @@ parseDef =
758 ( if mk then Just nps' else Nothing 752 ( if mk then Just nps' else Nothing
759 , foldr (uncurry SPi) (foldl SAppV (SGlobal x) $ downToS (length ts') $ length ts) ts') 753 , foldr (uncurry SPi) (foldl SAppV (SGlobal x) $ downToS (length ts') $ length ts) ts')
760 (af, cs) <- option (True, []) $ 754 (af, cs) <- option (True, []) $
761 do indent "where" $ fmap ((,) True) $ many $ second ((,) Nothing . dbf' npsd) <$> typedIds Nothing 755 do fmap ((,) True) $ indentMany "where" $ second ((,) Nothing . dbf' npsd) <$> typedIds Nothing
762 <|> (,) False <$ reservedOp "=" <*> 756 <|> (,) False <$ reservedOp "=" <*>
763 sepBy1 ((,) <$> (pure <$> parseSIName upperCase) 757 sepBy1 ((,) <$> (pure <$> parseSIName upperCase)
764 <*> do do braces $ mkConTy True . second (zipWith (\i (v, e) -> (v, dbf_ i npsd e)) [0..]) 758 <*> do do braces $ mkConTy True . second (zipWith (\i (v, e) -> (v, dbf_ i npsd e)) [0..])
@@ -771,21 +765,21 @@ parseDef =
771 <|> do indentation (reserved "class") $ do 765 <|> do indentation (reserved "class") $ do
772 x <- parseSIName $ typeNS upperCase 766 x <- parseSIName $ typeNS upperCase
773 (nps, ts) <- telescope (Just SType) 767 (nps, ts) <- telescope (Just SType)
774 cs <- option [] $ indent "where" $ many $ typedIds Nothing 768 cs <- option [] $ indentMany "where" $ typedIds Nothing
775 return $ pure $ Class x (map snd ts) (concatMap (\(vs, t) -> (,) <$> vs <*> pure (dbf' nps t)) cs) 769 return $ pure $ Class x (map snd ts) (concatMap (\(vs, t) -> (,) <$> vs <*> pure (dbf' nps t)) cs)
776 <|> do indentation (reserved "instance") $ typeNS $ do 770 <|> do indentation (reserved "instance") $ typeNS $ do
777 constraints <- option [] $ try "constraint" $ getTTuple' <$> parseTerm PrecOp <* reservedOp "=>" 771 constraints <- option [] $ try "constraint" $ getTTuple' <$> parseTerm PrecOp <* reservedOp "=>"
778 x <- parseSIName upperCase 772 x <- parseSIName upperCase
779 (nps, args) <- telescopePat 773 (nps, args) <- telescopePat
780 checkPattern nps 774 checkPattern nps
781 cs <- expNS $ option [] $ indent "where" $ some $ dbFunAlt nps <$> funAltDef varId 775 cs <- expNS $ option [] $ indentSome "where" $ dbFunAlt nps <$> funAltDef varId
782 pure . Instance x ({-todo-}map snd args) (dbff (nps <> [x]) <$> constraints) <$> compileFunAlts' id{-TODO-} cs 776 pure . Instance x ({-todo-}map snd args) (dbff (nps <> [x]) <$> constraints) <$> compileFunAlts' id{-TODO-} cs
783 <|> do indentation (try "type family" $ reserved "type" >> reserved "family") $ typeNS $ do 777 <|> do indentation (try "type family" $ reserved "type" >> reserved "family") $ typeNS $ do
784 x <- parseSIName upperCase 778 x <- parseSIName upperCase
785 (nps, ts) <- telescope (Just SType) 779 (nps, ts) <- telescope (Just SType)
786 t <- dbf' nps <$> parseType (Just SType) 780 t <- dbf' nps <$> parseType (Just SType)
787 option {-open type family-}[TypeFamily x ts t] $ do 781 option {-open type family-}[TypeFamily x ts t] $ do
788 cs <- indent "where" $ many $ funAltDef $ mfilter (== snd x) upperCase 782 cs <- indentMany "where" $ funAltDef $ mfilter (== snd x) upperCase
789 -- closed type family desugared here 783 -- closed type family desugared here
790 compileFunAlts False id SLabelEnd [TypeAnn x $ addParamsS ts t] cs 784 compileFunAlts False id SLabelEnd [TypeAnn x $ addParamsS ts t] cs
791 <|> do indentation (try "type instance" $ reserved "type" >> reserved "instance") $ typeNS $ pure <$> funAltDef upperCase 785 <|> do indentation (try "type instance" $ reserved "type" >> reserved "instance") $ typeNS $ pure <$> funAltDef upperCase
@@ -817,10 +811,10 @@ parseRHS fe tok = fmap (fmap (fe *** fe) +++ fe) $ indented $ do
817 <|> do 811 <|> do
818 reservedOp tok 812 reservedOp tok
819 rhs <- parseTerm PrecLam 813 rhs <- parseTerm PrecLam
820 f <- option id $ mkLets True <$> dsInfo <*> indent "where" (parseDefs xSLabelEnd) 814 f <- option id $ mkLets True <$> dsInfo <*> parseDefs xSLabelEnd (indentMany "where")
821 return $ Right $ f rhs 815 return $ Right $ f rhs
822 816
823parseDefs lend = many parseDef >>= compileFunAlts' lend . concat 817parseDefs lend p = p parseDef >>= compileFunAlts' lend . concat
824 818
825funAltDef parseName = do -- todo: use ns to determine parseName 819funAltDef parseName = do -- todo: use ns to determine parseName
826 (n, (fee, tss)) <- 820 (n, (fee, tss)) <-
@@ -855,7 +849,7 @@ desugarValueDef ds p e
855 n = mangleNames dns 849 n = mangleNames dns
856 850
857mangleNames xs = (foldMap fst xs, "_" ++ intercalate "_" (map snd xs)) 851mangleNames xs = (foldMap fst xs, "_" ++ intercalate "_" (map snd xs))
858 852{-
859parseSomeGuards f = do 853parseSomeGuards f = do
860 pos <- sourceColumn <$> getPosition <* reservedOp "|" 854 pos <- sourceColumn <$> getPosition <* reservedOp "|"
861 guard $ f pos 855 guard $ f pos
@@ -868,7 +862,7 @@ parseSomeGuards f = do
868 return (mempty, \gs' gs -> [GuardNode x "True" [] $ Alts gs', GuardNode x "False" [] $ Alts gs]) 862 return (mempty, \gs' gs -> [GuardNode x "True" [] $ Alts gs', GuardNode x "False" [] $ Alts gs])
869 f <$> ((map (dbfGT e') <$> parseSomeGuards (> pos)) <|> (:[]) . GuardLeaf <$ reservedOp "->" <*> (dbf' e' <$> parseETerm PrecLam)) 863 f <$> ((map (dbfGT e') <$> parseSomeGuards (> pos)) <|> (:[]) . GuardLeaf <$ reservedOp "->" <*> (dbf' e' <$> parseETerm PrecLam))
870 <*> option [] (parseSomeGuards (== pos)) 864 <*> option [] (parseSomeGuards (== pos))
871 865-}
872mkLets :: Bool -> DesugarInfo -> [Stmt]{-where block-} -> SExp{-main expression-} -> SExp{-big let with lambdas; replaces global names with de bruijn indices-} 866mkLets :: Bool -> DesugarInfo -> [Stmt]{-where block-} -> SExp{-main expression-} -> SExp{-big let with lambdas; replaces global names with de bruijn indices-}
873mkLets a ds = mkLets' a ds . sortDefs ds where 867mkLets a ds = mkLets' a ds . sortDefs ds where
874 mkLets' _ _ [] e = e 868 mkLets' _ _ [] e = e
@@ -1078,29 +1072,17 @@ parseModule f str = do
1078 { extensions = exts 1072 { extensions = exts
1079 , moduleImports = [("Prelude", ImportAllBut []) | NoImplicitPrelude `notElem` exts] ++ idefs 1073 , moduleImports = [("Prelude", ImportAllBut []) | NoImplicitPrelude `notElem` exts] ++ idefs
1080 , moduleExports = join $ snd <$> header 1074 , moduleExports = join $ snd <$> header
1081 , definitions = \ge -> first (show +++ id) $ flip runReader (ge, ns) . runWriterT $ runPT' (parseDefs SLabelEnd <* eof) st 1075 , definitions = \ge -> first (show +++ id) $ flip runReader (ge, ns) . runWriterT $ runPT' (parseDefs SLabelEnd indentMany' <* eof) st
1082 , sourceCode = str 1076 , sourceCode = str
1083 } 1077 }
1084 where
1085 runPT' p st --u name s
1086 = do res <- runParsecT p st -- (Pa.State s (initialPos name) u)
1087 r <- parserReply res
1088 case r of
1089 Ok x _ _ -> return (Right x)
1090 Error err -> return (Left err)
1091 where
1092 parserReply res
1093 = case res of
1094 Consumed r -> r
1095 Pa.Empty r -> r
1096 1078
1097parseLC :: MonadError ErrorMsg m => FilePath -> String -> m Module 1079parseLC :: MonadError ErrorMsg m => FilePath -> String -> m Module
1098parseLC f str 1080parseLC f str
1099 = either (throwError . ErrorMsg . show) return 1081 = either (throwError . ErrorMsg . show) return
1100 . flip runReader (error "globalenv used", Namespace (Just ExpLevel) True) 1082 . flip runReader (error "globalenv used", Namespace (Just ExpLevel) True)
1101 . fmap fst . runWriterT 1083 . fmap fst . runWriterT
1102 . runParserT (parseModule f str) (initialPos f) f 1084 . runParserT'' (parseModule f str) f
1103 . mkIndentStream 0 infIndentation True Ge . mkCharIndentStream 1085 . mkStream
1104 $ str 1086 $ str
1105 1087
1106-------------------------------------------------------------------------------- pretty print 1088-------------------------------------------------------------------------------- pretty print
diff --git a/testdata/Internals.out b/testdata/Internals.out
index 74350852..c34e2a0a 100644
--- a/testdata/Internals.out
+++ b/testdata/Internals.out
@@ -55,124 +55,129 @@ testdata/Internals.lc 22:34-22:35 Type
55testdata/Internals.lc 22:36-22:37 Type 55testdata/Internals.lc 22:36-22:37 Type
56testdata/Internals.lc 22:38-22:39 Type 56testdata/Internals.lc 22:38-22:39 Type
57testdata/Internals.lc 22:40-22:41 Type 57testdata/Internals.lc 22:40-22:41 Type
58testdata/Internals.lc 28:1-28:8 a:Type -> a -> a->a 58testdata/Internals.lc 27:1-27:8 a:Type -> a -> a->a
59testdata/Internals.lc 28:24-28:25 V1 59testdata/Internals.lc 27:24-27:25 V1
60testdata/Internals.lc 28:24-28:35 Type 60testdata/Internals.lc 27:24-27:35 Type
61testdata/Internals.lc 28:29-28:30 Type 61testdata/Internals.lc 27:29-27:30 Type
62testdata/Internals.lc 28:29-28:35 Type 62testdata/Internals.lc 27:29-27:35 Type
63testdata/Internals.lc 28:34-28:35 Type 63testdata/Internals.lc 27:34-27:35 Type
64testdata/Internals.lc 32:5-32:18 Type -> Type->Type 64testdata/Internals.lc 31:5-31:18 Type -> Type->Type
65testdata/Internals.lc 32:26-32:27 Type 65testdata/Internals.lc 31:26-31:27 Type
66testdata/Internals.lc 32:26-36:31 Type | Type -> Type->Type | Type->Type 66testdata/Internals.lc 31:26-35:31 Type | Type -> Type->Type | Type->Type
67testdata/Internals.lc 33:22-33:26 Type 67testdata/Internals.lc 32:22-32:26 Type
68testdata/Internals.lc 33:22-33:39 Type->Type 68testdata/Internals.lc 32:22-32:39 Type->Type
69testdata/Internals.lc 33:22-36:31 Type 69testdata/Internals.lc 32:22-35:31 Type
70testdata/Internals.lc 33:30-33:39 Type | Type -> Type->Type | Type->Type 70testdata/Internals.lc 32:30-32:39 Type | Type -> Type->Type | Type->Type
71testdata/Internals.lc 33:31-33:32 Type 71testdata/Internals.lc 32:31-32:32 Type
72testdata/Internals.lc 33:31-33:35 Type->Type 72testdata/Internals.lc 32:31-32:35 Type->Type
73testdata/Internals.lc 32:34-32:35 Type
74testdata/Internals.lc 32:37-32:38 Type
75testdata/Internals.lc 33:22-33:29 Type
76testdata/Internals.lc 33:22-33:45 Type->Type
77testdata/Internals.lc 33:22-35:31 Type
78testdata/Internals.lc 33:33-33:45 Type | Type -> Type -> Type->Type | Type -> Type->Type | Type->Type
73testdata/Internals.lc 33:34-33:35 Type 79testdata/Internals.lc 33:34-33:35 Type
80testdata/Internals.lc 33:34-33:38 Type -> Type->Type
81testdata/Internals.lc 33:34-33:41 Type->Type
74testdata/Internals.lc 33:37-33:38 Type 82testdata/Internals.lc 33:37-33:38 Type
75testdata/Internals.lc 34:22-34:29 Type 83testdata/Internals.lc 33:40-33:41 Type
76testdata/Internals.lc 34:22-34:45 Type->Type 84testdata/Internals.lc 33:43-33:44 Type
77testdata/Internals.lc 34:22-36:31 Type 85testdata/Internals.lc 34:22-34:32 Type
78testdata/Internals.lc 34:33-34:45 Type | Type -> Type -> Type->Type | Type -> Type->Type | Type->Type 86testdata/Internals.lc 34:22-34:51 Type->Type
79testdata/Internals.lc 34:34-34:35 Type 87testdata/Internals.lc 34:22-35:31 Type
80testdata/Internals.lc 34:34-34:38 Type -> Type->Type 88testdata/Internals.lc 34:36-34:51 Type | Type -> Type -> Type -> Type->Type | Type -> Type -> Type->Type | Type -> Type->Type | Type->Type
81testdata/Internals.lc 34:34-34:41 Type->Type
82testdata/Internals.lc 34:37-34:38 Type 89testdata/Internals.lc 34:37-34:38 Type
90testdata/Internals.lc 34:37-34:41 Type -> Type -> Type->Type
91testdata/Internals.lc 34:37-34:44 Type -> Type->Type
92testdata/Internals.lc 34:37-34:47 Type->Type
83testdata/Internals.lc 34:40-34:41 Type 93testdata/Internals.lc 34:40-34:41 Type
84testdata/Internals.lc 34:43-34:44 Type 94testdata/Internals.lc 34:43-34:44 Type
85testdata/Internals.lc 35:22-35:32 Type 95testdata/Internals.lc 34:46-34:47 Type
86testdata/Internals.lc 35:22-35:51 Type->Type 96testdata/Internals.lc 34:49-34:50 Type
87testdata/Internals.lc 35:22-36:31 Type 97testdata/Internals.lc 35:25-35:31 Type
88testdata/Internals.lc 35:36-35:51 Type | Type -> Type -> Type -> Type->Type | Type -> Type -> Type->Type | Type -> Type->Type | Type->Type 98testdata/Internals.lc 35:26-35:27 Type
89testdata/Internals.lc 35:37-35:38 Type 99testdata/Internals.lc 35:29-35:30 Type
90testdata/Internals.lc 35:37-35:41 Type -> Type -> Type->Type 100testdata/Internals.lc 38:13-38:15 Type -> Type->Type
91testdata/Internals.lc 35:37-35:44 Type -> Type->Type 101testdata/Internals.lc 41:13-41:17 a:Type -> a -> a->Type
92testdata/Internals.lc 35:37-35:47 Type->Type 102testdata/Internals.lc 41:24-41:28 Type
93testdata/Internals.lc 35:40-35:41 Type 103testdata/Internals.lc 41:36-41:37 Type
94testdata/Internals.lc 35:43-35:44 Type 104testdata/Internals.lc 41:36-41:46 Type
95testdata/Internals.lc 35:46-35:47 Type 105testdata/Internals.lc 41:45-41:46 Type
96testdata/Internals.lc 35:49-35:50 Type 106testdata/Internals.lc 43:6-43:11 Type -> Type->Type
97testdata/Internals.lc 36:25-36:31 Type 107testdata/Internals.lc 43:14-43:18 a:Type -> a -> a->Type
98testdata/Internals.lc 36:26-36:27 Type 108testdata/Internals.lc 43:14-43:23 Type -> Type->Type
99testdata/Internals.lc 36:29-36:30 Type 109testdata/Internals.lc 43:19-43:23 Type
100testdata/Internals.lc 39:13-39:15 Type -> Type->Type 110testdata/Internals.lc 48:1-48:4 Unit -> Unit->Unit
101testdata/Internals.lc 42:13-42:17 a:Type -> a -> a->Type 111testdata/Internals.lc 48:8-48:12 Type
102testdata/Internals.lc 42:24-42:28 Type 112testdata/Internals.lc 48:16-48:20 Type
103testdata/Internals.lc 42:36-42:37 Type 113testdata/Internals.lc 48:16-48:28 Type
104testdata/Internals.lc 42:36-42:46 Type 114testdata/Internals.lc 48:24-48:28 Type
105testdata/Internals.lc 42:45-42:46 Type 115testdata/Internals.lc 51:6-51:9 Type
106testdata/Internals.lc 44:6-44:11 Type -> Type->Type 116testdata/Internals.lc 52:6-52:10 Type
107testdata/Internals.lc 44:14-44:18 a:Type -> a -> a->Type 117testdata/Internals.lc 53:6-53:11 Type
108testdata/Internals.lc 44:14-44:23 Type -> Type->Type 118testdata/Internals.lc 54:6-54:10 Type
109testdata/Internals.lc 44:19-44:23 Type 119testdata/Internals.lc 56:6-56:10 Type
110testdata/Internals.lc 49:1-49:4 Unit -> Unit->Unit 120testdata/Internals.lc 56:6-56:25 Type
111testdata/Internals.lc 49:8-49:12 Type 121testdata/Internals.lc 56:13-56:18 Bool
112testdata/Internals.lc 49:16-49:20 Type 122testdata/Internals.lc 56:21-56:25 Bool
113testdata/Internals.lc 49:16-49:28 Type 123testdata/Internals.lc 58:6-58:14 Type
114testdata/Internals.lc 49:24-49:28 Type 124testdata/Internals.lc 58:6-58:29 Type
115testdata/Internals.lc 52:6-52:9 Type 125testdata/Internals.lc 58:17-58:19 Ordering
116testdata/Internals.lc 53:6-53:10 Type 126testdata/Internals.lc 58:22-58:24 Ordering
117testdata/Internals.lc 54:6-54:11 Type 127testdata/Internals.lc 58:27-58:29 Ordering
118testdata/Internals.lc 55:6-55:10 Type 128testdata/Internals.lc 60:6-60:9 Type
119testdata/Internals.lc 57:6-57:10 Type 129testdata/Internals.lc 60:6-60:23 Type
120testdata/Internals.lc 57:6-57:25 Type 130testdata/Internals.lc 60:12-60:16 Nat
121testdata/Internals.lc 57:13-57:18 Bool 131testdata/Internals.lc 60:19-60:23 Nat | Nat->Nat | Type
122testdata/Internals.lc 57:21-57:25 Bool 132testdata/Internals.lc 60:24-60:27 Type
123testdata/Internals.lc 59:6-59:14 Type 133testdata/Internals.lc 63:1-63:14 Int->Word
124testdata/Internals.lc 59:6-59:29 Type 134testdata/Internals.lc 63:24-63:27 Type
125testdata/Internals.lc 59:17-59:19 Ordering 135testdata/Internals.lc 63:33-63:37 Type
126testdata/Internals.lc 59:22-59:24 Ordering 136testdata/Internals.lc 64:1-64:15 Int->Float
127testdata/Internals.lc 59:27-59:29 Ordering
128testdata/Internals.lc 61:6-61:9 Type
129testdata/Internals.lc 61:6-61:23 Type
130testdata/Internals.lc 61:12-61:16 Nat
131testdata/Internals.lc 61:19-61:23 Nat | Nat->Nat | Type
132testdata/Internals.lc 61:24-61:27 Type
133testdata/Internals.lc 64:1-64:14 Int->Word
134testdata/Internals.lc 64:24-64:27 Type 137testdata/Internals.lc 64:24-64:27 Type
135testdata/Internals.lc 64:33-64:37 Type 138testdata/Internals.lc 64:33-64:38 Type
136testdata/Internals.lc 65:1-65:15 Int->Float 139testdata/Internals.lc 65:1-65:13 Int->Nat
137testdata/Internals.lc 65:24-65:27 Type 140testdata/Internals.lc 65:24-65:27 Type
138testdata/Internals.lc 65:33-65:38 Type 141testdata/Internals.lc 65:33-65:36 Type
139testdata/Internals.lc 66:1-66:13 Int->Nat 142testdata/Internals.lc 66:1-66:15 Int -> Int->Ordering
140testdata/Internals.lc 66:24-66:27 Type 143testdata/Internals.lc 66:24-66:27 Type
141testdata/Internals.lc 66:33-66:36 Type 144testdata/Internals.lc 66:33-66:36 Type
142testdata/Internals.lc 67:1-67:15 Int -> Int->Ordering 145testdata/Internals.lc 66:33-66:50 Type
143testdata/Internals.lc 67:24-67:27 Type 146testdata/Internals.lc 66:42-66:50 Type
144testdata/Internals.lc 67:33-67:36 Type 147testdata/Internals.lc 67:1-67:16 Word -> Word->Ordering
148testdata/Internals.lc 67:24-67:28 Type
149testdata/Internals.lc 67:33-67:37 Type
145testdata/Internals.lc 67:33-67:50 Type 150testdata/Internals.lc 67:33-67:50 Type
146testdata/Internals.lc 67:42-67:50 Type 151testdata/Internals.lc 67:42-67:50 Type
147testdata/Internals.lc 68:1-68:16 Word -> Word->Ordering 152testdata/Internals.lc 68:1-68:17 Float -> Float->Ordering
148testdata/Internals.lc 68:24-68:28 Type 153testdata/Internals.lc 68:24-68:29 Type
149testdata/Internals.lc 68:33-68:37 Type 154testdata/Internals.lc 68:33-68:38 Type
150testdata/Internals.lc 68:33-68:50 Type 155testdata/Internals.lc 68:33-68:50 Type
151testdata/Internals.lc 68:42-68:50 Type 156testdata/Internals.lc 68:42-68:50 Type
152testdata/Internals.lc 69:1-69:17 Float -> Float->Ordering 157testdata/Internals.lc 69:1-69:16 Char -> Char->Ordering
153testdata/Internals.lc 69:24-69:29 Type 158testdata/Internals.lc 69:24-69:28 Type
154testdata/Internals.lc 69:33-69:38 Type 159testdata/Internals.lc 69:33-69:37 Type
155testdata/Internals.lc 69:33-69:50 Type 160testdata/Internals.lc 69:33-69:50 Type
156testdata/Internals.lc 69:42-69:50 Type 161testdata/Internals.lc 69:42-69:50 Type
157testdata/Internals.lc 70:1-70:16 Char -> Char->Ordering 162testdata/Internals.lc 70:1-70:18 String -> String->Ordering
158testdata/Internals.lc 70:24-70:28 Type 163testdata/Internals.lc 70:24-70:30 Type
159testdata/Internals.lc 70:33-70:37 Type 164testdata/Internals.lc 70:34-70:40 Type
160testdata/Internals.lc 70:33-70:50 Type 165testdata/Internals.lc 70:34-70:52 Type
161testdata/Internals.lc 70:42-70:50 Type 166testdata/Internals.lc 70:44-70:52 Type
162testdata/Internals.lc 71:1-71:18 String -> String->Ordering 167testdata/Internals.lc 71:1-71:14 Int->Int
163testdata/Internals.lc 71:24-71:30 Type 168testdata/Internals.lc 71:24-71:27 Type
164testdata/Internals.lc 71:34-71:40 Type 169testdata/Internals.lc 71:33-71:36 Type
165testdata/Internals.lc 71:34-71:52 Type 170testdata/Internals.lc 72:1-72:15 Word->Word
166testdata/Internals.lc 71:44-71:52 Type 171testdata/Internals.lc 72:24-72:28 Type
167testdata/Internals.lc 72:1-72:14 Int->Int 172testdata/Internals.lc 72:33-72:37 Type
168testdata/Internals.lc 72:24-72:27 Type 173testdata/Internals.lc 73:1-73:16 Float->Float
169testdata/Internals.lc 72:33-72:36 Type 174testdata/Internals.lc 73:24-73:29 Type
170testdata/Internals.lc 73:1-73:15 Word->Word 175testdata/Internals.lc 73:33-73:38 Type
171testdata/Internals.lc 73:24-73:28 Type 176testdata/Internals.lc 74:1-74:11 Int -> Int->Int
172testdata/Internals.lc 73:33-73:37 Type 177testdata/Internals.lc 74:24-74:27 Type
173testdata/Internals.lc 74:1-74:16 Float->Float 178testdata/Internals.lc 74:33-74:36 Type
174testdata/Internals.lc 74:24-74:29 Type 179testdata/Internals.lc 74:33-74:45 Type
175testdata/Internals.lc 74:33-74:38 Type 180testdata/Internals.lc 74:42-74:45 Type
176testdata/Internals.lc 75:1-75:11 Int -> Int->Int 181testdata/Internals.lc 75:1-75:11 Int -> Int->Int
177testdata/Internals.lc 75:24-75:27 Type 182testdata/Internals.lc 75:24-75:27 Type
178testdata/Internals.lc 75:33-75:36 Type 183testdata/Internals.lc 75:33-75:36 Type
@@ -183,186 +188,181 @@ testdata/Internals.lc 76:24-76:27 Type
183testdata/Internals.lc 76:33-76:36 Type 188testdata/Internals.lc 76:33-76:36 Type
184testdata/Internals.lc 76:33-76:45 Type 189testdata/Internals.lc 76:33-76:45 Type
185testdata/Internals.lc 76:42-76:45 Type 190testdata/Internals.lc 76:42-76:45 Type
186testdata/Internals.lc 77:1-77:11 Int -> Int->Int 191testdata/Internals.lc 77:1-77:14 Float->Float
187testdata/Internals.lc 77:24-77:27 Type 192testdata/Internals.lc 77:24-77:29 Type
188testdata/Internals.lc 77:33-77:36 Type 193testdata/Internals.lc 77:33-77:38 Type
189testdata/Internals.lc 77:33-77:45 Type 194testdata/Internals.lc 78:1-78:10 Float->Int
190testdata/Internals.lc 77:42-77:45 Type
191testdata/Internals.lc 78:1-78:14 Float->Float
192testdata/Internals.lc 78:24-78:29 Type 195testdata/Internals.lc 78:24-78:29 Type
193testdata/Internals.lc 78:33-78:38 Type 196testdata/Internals.lc 78:33-78:36 Type
194testdata/Internals.lc 79:1-79:10 Float->Int 197testdata/Internals.lc 81:19-81:23 Type
195testdata/Internals.lc 79:24-79:29 Type 198testdata/Internals.lc 81:19-81:38 Type
196testdata/Internals.lc 79:33-79:36 Type 199testdata/Internals.lc 81:27-81:28 V2
197testdata/Internals.lc 82:19-82:23 Type 200testdata/Internals.lc 81:27-81:38 Type
198testdata/Internals.lc 82:19-82:38 Type 201testdata/Internals.lc 81:32-81:33 Type
199testdata/Internals.lc 82:27-82:28 V2 202testdata/Internals.lc 81:32-81:38 Type
200testdata/Internals.lc 82:27-82:38 Type 203testdata/Internals.lc 81:37-81:38 Type
201testdata/Internals.lc 82:32-82:33 Type 204testdata/Internals.lc 82:1-82:15 {a} -> Bool -> a -> a->a
202testdata/Internals.lc 82:32-82:38 Type 205testdata/Internals.lc 82:16-82:20 Bool
203testdata/Internals.lc 82:37-82:38 Type 206testdata/Internals.lc 82:16-83:29 Bool -> V1 -> V2->V3 | V1 -> V2->V3 | V2->V3 | V3
204testdata/Internals.lc 83:1-83:15 {a} -> Bool -> a -> a->a 207testdata/Internals.lc 82:28-82:29 V3
205testdata/Internals.lc 83:16-83:20 Bool 208testdata/Internals.lc 82:28-83:29 Bool->V4
206testdata/Internals.lc 83:16-84:29 Bool -> V1 -> V2->V3 | V1 -> V2->V3 | V2->V3 | V3 209testdata/Internals.lc 83:28-83:29 V4
207testdata/Internals.lc 83:28-83:29 V3 210testdata/Internals.lc 85:1-85:5 Ordering->Bool
208testdata/Internals.lc 83:28-84:29 Bool->V4 211testdata/Internals.lc 85:6-85:8 V1
209testdata/Internals.lc 84:28-84:29 V4 212testdata/Internals.lc 85:6-86:15 Bool
210testdata/Internals.lc 86:1-86:5 Ordering->Bool 213testdata/Internals.lc 85:11-85:15 Bool
211testdata/Internals.lc 86:6-86:8 V1 214testdata/Internals.lc 85:11-86:15 Bool -> Ordering->Bool
212testdata/Internals.lc 86:6-87:15 Bool 215testdata/Internals.lc 86:10-86:15 Bool
213testdata/Internals.lc 86:11-86:15 Bool 216testdata/Internals.lc 89:7-89:10 Type->Type
214testdata/Internals.lc 86:11-87:15 Bool -> Ordering->Bool 217testdata/Internals.lc 89:7-90:22 Type
215testdata/Internals.lc 87:10-87:15 Bool 218testdata/Internals.lc 89:7-91:32 Type
216testdata/Internals.lc 90:7-90:10 Type->Type 219testdata/Internals.lc 89:7-92:19 Type
217testdata/Internals.lc 90:7-91:22 Type 220testdata/Internals.lc 90:3-90:10 {a} -> {b : Num a} -> Int->a
218testdata/Internals.lc 90:7-92:32 Type 221testdata/Internals.lc 90:14-90:17 Type
219testdata/Internals.lc 90:7-93:19 Type 222testdata/Internals.lc 90:14-90:22 Type
220testdata/Internals.lc 91:3-91:10 {a} -> {b : Num a} -> Int->a 223testdata/Internals.lc 90:21-90:22 Type
221testdata/Internals.lc 91:14-91:17 Type 224testdata/Internals.lc 91:3-91:10 {a} -> {b : Num a} -> a -> a->Ordering
222testdata/Internals.lc 91:14-91:22 Type 225testdata/Internals.lc 91:14-91:15 Type
223testdata/Internals.lc 91:21-91:22 Type 226testdata/Internals.lc 91:14-91:32 Type
224testdata/Internals.lc 92:3-92:10 {a} -> {b : Num a} -> a -> a->Ordering 227testdata/Internals.lc 91:19-91:20 Type
225testdata/Internals.lc 92:14-92:15 Type 228testdata/Internals.lc 91:19-91:32 Type
226testdata/Internals.lc 92:14-92:32 Type 229testdata/Internals.lc 91:24-91:32 Type
227testdata/Internals.lc 92:19-92:20 Type 230testdata/Internals.lc 92:3-92:9 {a} -> {b : Num a} -> a->a
228testdata/Internals.lc 92:19-92:32 Type 231testdata/Internals.lc 92:13-92:14 Type
229testdata/Internals.lc 92:24-92:32 Type 232testdata/Internals.lc 92:13-92:19 Type
230testdata/Internals.lc 93:3-93:9 {a} -> {b : Num a} -> a->a 233testdata/Internals.lc 92:18-92:19 Type
231testdata/Internals.lc 93:13-93:14 Type 234testdata/Internals.lc 94:14-94:17 Type
232testdata/Internals.lc 93:13-93:19 Type 235testdata/Internals.lc 94:14-95:20 ({a : Num V0} -> Int->V2) -> {d : Num V1} -> Int->V3
233testdata/Internals.lc 93:18-93:19 Type 236testdata/Internals.lc 94:14-96:27 ({a : Num V0} -> V1 -> V2->Ordering) -> {e : Num V1} -> V2 -> V3->Ordering
234testdata/Internals.lc 95:14-95:17 Type 237testdata/Internals.lc 94:14-97:26 ({a : Num V0} -> V1->V2) -> {d : Num V1} -> V2->V3
235testdata/Internals.lc 95:14-96:20 ({a : Num V0} -> Int->V2) -> {d : Num V1} -> Int->V3 238testdata/Internals.lc 94:14-106:17 Type | Type->Type
236testdata/Internals.lc 95:14-97:27 ({a : Num V0} -> V1 -> V2->Ordering) -> {e : Num V1} -> V2 -> V3->Ordering 239testdata/Internals.lc 94:14-107:25 {a : Num V0} -> Int->V2 | {a} -> {b : Num a} -> Int->a
237testdata/Internals.lc 95:14-98:26 ({a : Num V0} -> V1->V2) -> {d : Num V1} -> V2->V3 240testdata/Internals.lc 94:14-108:22 {a : Num V0} -> V1 -> V2->Ordering | {a} -> {b : Num a} -> a -> a->Ordering
238testdata/Internals.lc 95:14-107:17 Type | Type->Type 241testdata/Internals.lc 94:14-109:22 {a : Num V0} -> V1->V2 | {a} -> {b : Num a} -> a->a
239testdata/Internals.lc 95:14-108:25 {a : Num V0} -> Int->V2 | {a} -> {b : Num a} -> Int->a 242testdata/Internals.lc 95:13-95:20 Int->Int
240testdata/Internals.lc 95:14-109:22 {a : Num V0} -> V1 -> V2->Ordering | {a} -> {b : Num a} -> a -> a->Ordering 243testdata/Internals.lc 95:19-95:20 Int
241testdata/Internals.lc 95:14-110:22 {a : Num V0} -> V1->V2 | {a} -> {b : Num a} -> a->a 244testdata/Internals.lc 96:13-96:27 Int -> Int->Ordering
242testdata/Internals.lc 96:13-96:20 Int->Int 245testdata/Internals.lc 97:13-97:26 Int->Int
243testdata/Internals.lc 96:19-96:20 Int 246testdata/Internals.lc 98:14-98:18 Type
244testdata/Internals.lc 97:13-97:27 Int -> Int->Ordering 247testdata/Internals.lc 98:14-99:26 ({a : Num V0} -> Int->V2) -> {d : Num V1} -> Int->V3
245testdata/Internals.lc 98:13-98:26 Int->Int 248testdata/Internals.lc 98:14-100:28 ({a : Num V0} -> V1 -> V2->Ordering) -> {e : Num V1} -> V2 -> V3->Ordering
246testdata/Internals.lc 99:14-99:18 Type 249testdata/Internals.lc 98:14-101:27 ({a : Num V0} -> V1->V2) -> {d : Num V1} -> V2->V3
247testdata/Internals.lc 99:14-100:26 ({a : Num V0} -> Int->V2) -> {d : Num V1} -> Int->V3 250testdata/Internals.lc 98:14-106:17 Type
248testdata/Internals.lc 99:14-101:28 ({a : Num V0} -> V1 -> V2->Ordering) -> {e : Num V1} -> V2 -> V3->Ordering 251testdata/Internals.lc 98:14-107:25 {a : Num V0} -> Int->V2
249testdata/Internals.lc 99:14-102:27 ({a : Num V0} -> V1->V2) -> {d : Num V1} -> V2->V3 252testdata/Internals.lc 98:14-108:22 {a : Num V0} -> V1 -> V2->Ordering
250testdata/Internals.lc 99:14-107:17 Type 253testdata/Internals.lc 98:14-109:22 {a : Num V0} -> V1->V2
251testdata/Internals.lc 99:14-108:25 {a : Num V0} -> Int->V2 254testdata/Internals.lc 99:13-99:26 Int->Word
252testdata/Internals.lc 99:14-109:22 {a : Num V0} -> V1 -> V2->Ordering 255testdata/Internals.lc 100:13-100:28 Word -> Word->Ordering
253testdata/Internals.lc 99:14-110:22 {a : Num V0} -> V1->V2 256testdata/Internals.lc 101:13-101:27 Word->Word
254testdata/Internals.lc 100:13-100:26 Int->Word 257testdata/Internals.lc 102:14-102:19 Type
255testdata/Internals.lc 101:13-101:28 Word -> Word->Ordering 258testdata/Internals.lc 102:14-103:27 ({a : Num V0} -> Int->V2) -> {d : Num V1} -> Int->V3
256testdata/Internals.lc 102:13-102:27 Word->Word 259testdata/Internals.lc 102:14-104:29 ({a : Num V0} -> V1 -> V2->Ordering) -> {e : Num V1} -> V2 -> V3->Ordering
257testdata/Internals.lc 103:14-103:19 Type 260testdata/Internals.lc 102:14-105:28 ({a : Num V0} -> V1->V2) -> {d : Num V1} -> V2->V3
258testdata/Internals.lc 103:14-104:27 ({a : Num V0} -> Int->V2) -> {d : Num V1} -> Int->V3 261testdata/Internals.lc 102:14-106:17 Type
259testdata/Internals.lc 103:14-105:29 ({a : Num V0} -> V1 -> V2->Ordering) -> {e : Num V1} -> V2 -> V3->Ordering 262testdata/Internals.lc 102:14-107:25 {a : Num V0} -> Int->V2
260testdata/Internals.lc 103:14-106:28 ({a : Num V0} -> V1->V2) -> {d : Num V1} -> V2->V3 263testdata/Internals.lc 102:14-108:22 {a : Num V0} -> V1 -> V2->Ordering
261testdata/Internals.lc 103:14-107:17 Type 264testdata/Internals.lc 102:14-109:22 {a : Num V0} -> V1->V2
262testdata/Internals.lc 103:14-108:25 {a : Num V0} -> Int->V2 265testdata/Internals.lc 103:13-103:27 Int->Float
263testdata/Internals.lc 103:14-109:22 {a : Num V0} -> V1 -> V2->Ordering 266testdata/Internals.lc 104:13-104:29 Float -> Float->Ordering
264testdata/Internals.lc 103:14-110:22 {a : Num V0} -> V1->V2 267testdata/Internals.lc 105:13-105:28 Float->Float
265testdata/Internals.lc 104:13-104:27 Int->Float 268testdata/Internals.lc 106:14-106:17 Type
266testdata/Internals.lc 105:13-105:29 Float -> Float->Ordering 269testdata/Internals.lc 106:14-107:25 ({a : Num V0} -> Int->V2) -> {d : Num V1} -> Int->V3
267testdata/Internals.lc 106:13-106:28 Float->Float 270testdata/Internals.lc 106:14-108:22 ({a : Num V0} -> V1 -> V2->Ordering) -> {e : Num V1} -> V2 -> V3->Ordering
268testdata/Internals.lc 107:14-107:17 Type 271testdata/Internals.lc 106:14-109:22 ({a : Num V0} -> V1->V2) -> {d : Num V1} -> V2->V3
269testdata/Internals.lc 107:14-108:25 ({a : Num V0} -> Int->V2) -> {d : Num V1} -> Int->V3 272testdata/Internals.lc 107:13-107:25 Int->Nat
270testdata/Internals.lc 107:14-109:22 ({a : Num V0} -> V1 -> V2->Ordering) -> {e : Num V1} -> V2 -> V3->Ordering 273testdata/Internals.lc 108:13-108:22 {a:Unit} -> Nat -> Nat->Ordering
271testdata/Internals.lc 107:14-110:22 ({a : Num V0} -> V1->V2) -> {d : Num V1} -> V2->V3 274testdata/Internals.lc 109:13-109:22 {a:Unit} -> Nat->Nat
272testdata/Internals.lc 108:13-108:25 Int->Nat 275testdata/Internals.lc 111:7-111:9 Type->Type
273testdata/Internals.lc 109:13-109:22 {a:Unit} -> Nat -> Nat->Ordering 276testdata/Internals.lc 111:7-112:27 Type
274testdata/Internals.lc 110:13-110:22 {a:Unit} -> Nat->Nat 277testdata/Internals.lc 111:7-127:29 V0->V1 | {a} -> {b : Eq a} -> a -> a->Bool
275testdata/Internals.lc 112:7-112:9 Type->Type 278testdata/Internals.lc 112:5-112:9 {a} -> {b : Eq a} -> a -> a->Bool
276testdata/Internals.lc 112:7-113:27 Type 279testdata/Internals.lc 112:13-112:14 Type
277testdata/Internals.lc 112:7-128:29 V0->V1 | {a} -> {b : Eq a} -> a -> a->Bool 280testdata/Internals.lc 112:13-112:27 Type
278testdata/Internals.lc 113:5-113:9 {a} -> {b : Eq a} -> a -> a->Bool 281testdata/Internals.lc 112:18-112:19 Type
279testdata/Internals.lc 113:13-113:14 Type 282testdata/Internals.lc 112:18-112:27 Type
280testdata/Internals.lc 113:13-113:27 Type 283testdata/Internals.lc 112:23-112:27 Type
281testdata/Internals.lc 113:18-113:19 Type 284testdata/Internals.lc 116:13-116:19 Type
282testdata/Internals.lc 113:18-113:27 Type 285testdata/Internals.lc 116:13-116:63 ({a : Eq V0} -> V1 -> V2->Bool) -> {e : Eq V1} -> V2 -> V3->Bool
283testdata/Internals.lc 113:23-113:27 Type 286testdata/Internals.lc 116:13-124:16 Type | Type->Type
284testdata/Internals.lc 117:13-117:19 Type 287testdata/Internals.lc 116:13-127:29 {a : Eq V0} -> V1 -> V2->Bool | {a} -> {b : Eq a} -> a -> a->Bool
285testdata/Internals.lc 117:13-117:63 ({a : Eq V0} -> V1 -> V2->Bool) -> {e : Eq V1} -> V2 -> V3->Bool 288testdata/Internals.lc 116:35-116:39 Ordering->Bool
286testdata/Internals.lc 117:13-125:16 Type | Type->Type 289testdata/Internals.lc 116:35-116:63 Bool | String -> String->Bool | String->Bool
287testdata/Internals.lc 117:13-128:29 {a : Eq V0} -> V1 -> V2->Bool | {a} -> {b : Eq a} -> a -> a->Bool 290testdata/Internals.lc 116:40-116:63 Ordering
288testdata/Internals.lc 117:35-117:39 Ordering->Bool 291testdata/Internals.lc 116:41-116:58 String -> String->Ordering
289testdata/Internals.lc 117:35-117:63 Bool | String -> String->Bool | String->Bool 292testdata/Internals.lc 116:41-116:60 String->Ordering
290testdata/Internals.lc 117:40-117:63 Ordering 293testdata/Internals.lc 116:59-116:60 String
291testdata/Internals.lc 117:41-117:58 String -> String->Ordering 294testdata/Internals.lc 116:61-116:62 String
292testdata/Internals.lc 117:41-117:60 String->Ordering 295testdata/Internals.lc 117:13-117:17 Type
293testdata/Internals.lc 117:59-117:60 String 296testdata/Internals.lc 117:13-117:59 ({a : Eq V0} -> V1 -> V2->Bool) -> {e : Eq V1} -> V2 -> V3->Bool
294testdata/Internals.lc 117:61-117:62 String 297testdata/Internals.lc 117:13-124:16 Type
295testdata/Internals.lc 118:13-118:17 Type 298testdata/Internals.lc 117:13-127:29 {a : Eq V0} -> V1 -> V2->Bool
296testdata/Internals.lc 118:13-118:59 ({a : Eq V0} -> V1 -> V2->Bool) -> {e : Eq V1} -> V2 -> V3->Bool 299testdata/Internals.lc 117:33-117:37 Ordering->Bool
297testdata/Internals.lc 118:13-125:16 Type 300testdata/Internals.lc 117:33-117:59 Bool | Char -> Char->Bool | Char->Bool
298testdata/Internals.lc 118:13-128:29 {a : Eq V0} -> V1 -> V2->Bool 301testdata/Internals.lc 117:38-117:59 Ordering
299testdata/Internals.lc 118:33-118:37 Ordering->Bool 302testdata/Internals.lc 117:39-117:54 Char -> Char->Ordering
300testdata/Internals.lc 118:33-118:59 Bool | Char -> Char->Bool | Char->Bool 303testdata/Internals.lc 117:39-117:56 Char->Ordering
301testdata/Internals.lc 118:38-118:59 Ordering 304testdata/Internals.lc 117:55-117:56 Char
302testdata/Internals.lc 118:39-118:54 Char -> Char->Ordering 305testdata/Internals.lc 117:57-117:58 Char
303testdata/Internals.lc 118:39-118:56 Char->Ordering 306testdata/Internals.lc 118:13-118:16 Type
304testdata/Internals.lc 118:55-118:56 Char 307testdata/Internals.lc 118:13-118:57 ({a : Eq V0} -> V1 -> V2->Bool) -> {e : Eq V1} -> V2 -> V3->Bool
305testdata/Internals.lc 118:57-118:58 Char 308testdata/Internals.lc 118:13-124:16 Type
306testdata/Internals.lc 119:13-119:16 Type 309testdata/Internals.lc 118:13-127:29 {a : Eq V0} -> V1 -> V2->Bool
307testdata/Internals.lc 119:13-119:57 ({a : Eq V0} -> V1 -> V2->Bool) -> {e : Eq V1} -> V2 -> V3->Bool 310testdata/Internals.lc 118:32-118:36 Ordering->Bool
308testdata/Internals.lc 119:13-125:16 Type 311testdata/Internals.lc 118:32-118:57 Bool | Int -> Int->Bool | Int->Bool
309testdata/Internals.lc 119:13-128:29 {a : Eq V0} -> V1 -> V2->Bool 312testdata/Internals.lc 118:37-118:57 Ordering
310testdata/Internals.lc 119:32-119:36 Ordering->Bool 313testdata/Internals.lc 118:38-118:52 Int -> Int->Ordering
311testdata/Internals.lc 119:32-119:57 Bool | Int -> Int->Bool | Int->Bool 314testdata/Internals.lc 118:38-118:54 Int->Ordering
312testdata/Internals.lc 119:37-119:57 Ordering 315testdata/Internals.lc 118:53-118:54 Int
313testdata/Internals.lc 119:38-119:52 Int -> Int->Ordering 316testdata/Internals.lc 118:55-118:56 Int
314testdata/Internals.lc 119:38-119:54 Int->Ordering 317testdata/Internals.lc 119:13-119:18 Type
315testdata/Internals.lc 119:53-119:54 Int 318testdata/Internals.lc 119:13-119:61 ({a : Eq V0} -> V1 -> V2->Bool) -> {e : Eq V1} -> V2 -> V3->Bool
316testdata/Internals.lc 119:55-119:56 Int 319testdata/Internals.lc 119:13-124:16 Type
317testdata/Internals.lc 120:13-120:18 Type 320testdata/Internals.lc 119:13-127:29 {a : Eq V0} -> V1 -> V2->Bool
318testdata/Internals.lc 120:13-120:61 ({a : Eq V0} -> V1 -> V2->Bool) -> {e : Eq V1} -> V2 -> V3->Bool 321testdata/Internals.lc 119:34-119:38 Ordering->Bool
319testdata/Internals.lc 120:13-125:16 Type 322testdata/Internals.lc 119:34-119:61 Bool | Float -> Float->Bool | Float->Bool
320testdata/Internals.lc 120:13-128:29 {a : Eq V0} -> V1 -> V2->Bool 323testdata/Internals.lc 119:39-119:61 Ordering
321testdata/Internals.lc 120:34-120:38 Ordering->Bool 324testdata/Internals.lc 119:40-119:56 Float -> Float->Ordering
322testdata/Internals.lc 120:34-120:61 Bool | Float -> Float->Bool | Float->Bool 325testdata/Internals.lc 119:40-119:58 Float->Ordering
323testdata/Internals.lc 120:39-120:61 Ordering 326testdata/Internals.lc 119:57-119:58 Float
324testdata/Internals.lc 120:40-120:56 Float -> Float->Ordering 327testdata/Internals.lc 119:59-119:60 Float
325testdata/Internals.lc 120:40-120:58 Float->Ordering 328testdata/Internals.lc 120:13-120:17 Type
326testdata/Internals.lc 120:57-120:58 Float 329testdata/Internals.lc 120:13-123:19 ({a : Eq V0} -> V1 -> V2->Bool) -> {e : Eq V1} -> V2 -> V3->Bool
327testdata/Internals.lc 120:59-120:60 Float 330testdata/Internals.lc 120:13-124:16 Type
328testdata/Internals.lc 121:13-121:17 Type 331testdata/Internals.lc 120:13-127:29 {a : Eq V0} -> V1 -> V2->Bool
329testdata/Internals.lc 121:13-124:19 ({a : Eq V0} -> V1 -> V2->Bool) -> {e : Eq V1} -> V2 -> V3->Bool 332testdata/Internals.lc 121:5-121:9 Bool
330testdata/Internals.lc 121:13-125:16 Type 333testdata/Internals.lc 121:5-123:19 Bool | Bool -> Bool->Bool | Bool->Bool
331testdata/Internals.lc 121:13-128:29 {a : Eq V0} -> V1 -> V2->Bool 334testdata/Internals.lc 121:13-121:17 Bool
332testdata/Internals.lc 122:5-122:9 Bool 335testdata/Internals.lc 121:13-123:19 Bool
333testdata/Internals.lc 122:5-124:19 Bool | Bool -> Bool->Bool | Bool->Bool 336testdata/Internals.lc 121:20-121:24 Bool
334testdata/Internals.lc 122:13-122:17 Bool 337testdata/Internals.lc 121:20-123:19 Bool->Bool
335testdata/Internals.lc 122:13-124:19 Bool 338testdata/Internals.lc 122:14-122:19 Bool
336testdata/Internals.lc 122:20-122:24 Bool 339testdata/Internals.lc 122:14-123:19 Bool
337testdata/Internals.lc 122:20-124:19 Bool->Bool 340testdata/Internals.lc 122:22-122:26 Bool
341testdata/Internals.lc 122:22-123:19 Bool->Bool
338testdata/Internals.lc 123:14-123:19 Bool 342testdata/Internals.lc 123:14-123:19 Bool
339testdata/Internals.lc 123:14-124:19 Bool 343testdata/Internals.lc 124:13-124:16 Type
340testdata/Internals.lc 123:22-123:26 Bool 344testdata/Internals.lc 124:13-127:29 ({a : Eq V0} -> V1 -> V2->Bool) -> {e : Eq V1} -> V2 -> V3->Bool
341testdata/Internals.lc 123:22-124:19 Bool->Bool 345testdata/Internals.lc 125:5-125:9 Nat
342testdata/Internals.lc 124:14-124:19 Bool 346testdata/Internals.lc 125:5-127:29 Bool | Nat -> Nat->Bool | Nat->Bool
343testdata/Internals.lc 125:13-125:16 Type 347testdata/Internals.lc 125:15-125:19 Nat
344testdata/Internals.lc 125:13-128:29 ({a : Eq V0} -> V1 -> V2->Bool) -> {e : Eq V1} -> V2 -> V3->Bool 348testdata/Internals.lc 125:15-127:29 Bool
345testdata/Internals.lc 126:5-126:9 Nat 349testdata/Internals.lc 125:24-125:28 Bool
346testdata/Internals.lc 126:5-128:29 Bool | Nat -> Nat->Bool | Nat->Bool 350testdata/Internals.lc 125:24-127:29 Nat->Bool
347testdata/Internals.lc 126:15-126:19 Nat 351testdata/Internals.lc 126:15-126:19 Nat
348testdata/Internals.lc 126:15-128:29 Bool 352testdata/Internals.lc 126:15-127:29 Bool | Nat->Bool
349testdata/Internals.lc 126:24-126:28 Bool 353testdata/Internals.lc 126:24-126:25 Nat
350testdata/Internals.lc 126:24-128:29 Nat->Bool 354testdata/Internals.lc 126:24-126:28 Nat->Bool
351testdata/Internals.lc 127:15-127:19 Nat 355testdata/Internals.lc 126:24-126:30 Bool | Nat->Bool
352testdata/Internals.lc 127:15-128:29 Bool | Nat->Bool 356testdata/Internals.lc 126:24-127:29 Nat->Bool
353testdata/Internals.lc 127:24-127:25 Nat 357testdata/Internals.lc 126:26-126:28 {a} -> {b : Eq a} -> a -> a->Bool
354testdata/Internals.lc 127:24-127:28 Nat->Bool 358testdata/Internals.lc 126:29-126:30 Nat
355testdata/Internals.lc 127:24-127:30 Bool | Nat->Bool 359testdata/Internals.lc 127:24-127:29 Bool | Nat->Bool
356testdata/Internals.lc 127:24-128:29 Nat->Bool 360testdata/Internals.lc 129:6-129:10 Type | Type->Type
357testdata/Internals.lc 127:26-127:28 {a} -> {b : Eq a} -> a -> a->Bool 361testdata/Internals.lc 129:6-129:25 Type
358testdata/Internals.lc 127:29-127:30 Nat 362testdata/Internals.lc 129:6-129:36 Type
359testdata/Internals.lc 128:24-128:29 Bool | Nat->Bool 363testdata/Internals.lc 129:15-129:18 List V1 | {a} -> List a
360testdata/Internals.lc 130:6-130:10 Type | Type->Type 364testdata/Internals.lc 129:21-129:25 List V4 | Type | {a} -> a -> List a -> List a
361testdata/Internals.lc 130:6-130:25 Type 365testdata/Internals.lc 129:26-129:27 Type
362testdata/Internals.lc 130:6-130:36 Type 366testdata/Internals.lc 129:28-129:36 Type
363testdata/Internals.lc 130:15-130:18 List V1 | {a} -> List a 367testdata/Internals.lc 129:29-129:33 Type->Type
364testdata/Internals.lc 130:21-130:25 List V4 | Type | {a} -> a -> List a -> List a 368testdata/Internals.lc 129:34-129:35 Type
365testdata/Internals.lc 130:26-130:27 Type
366testdata/Internals.lc 130:28-130:36 Type
367testdata/Internals.lc 130:29-130:33 Type->Type
368testdata/Internals.lc 130:34-130:35 Type