summaryrefslogtreecommitdiff
path: root/compiler/GHC/Parser.y
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/Parser.y')
-rw-r--r--compiler/GHC/Parser.y21
1 files changed, 13 insertions, 8 deletions
diff --git a/compiler/GHC/Parser.y b/compiler/GHC/Parser.y
index efd8831418..12f5b8be3b 100644
--- a/compiler/GHC/Parser.y
+++ b/compiler/GHC/Parser.y
@@ -280,7 +280,7 @@ Context:
context -> btype .
type -> btype .
type -> btype . '->' ctype
- type -> btype . '#->' ctype
+ type -> btype . '->.' ctype
Example:
a :: Maybe Integer -> Bool
@@ -636,7 +636,7 @@ are the most common patterns, rewritten as regular expressions for clarity:
'|' { L _ ITvbar }
'<-' { L _ (ITlarrow _) }
'->' { L _ (ITrarrow _) }
- '#->' { L _ (ITlolly _) }
+ '->.' { L _ ITlolly }
TIGHT_INFIX_AT { L _ ITat }
'=>' { L _ (ITdarrow _) }
'-' { L _ ITminus }
@@ -650,6 +650,7 @@ are the most common patterns, rewritten as regular expressions for clarity:
'>>-' { L _ (ITRarrowtail _) } -- for arrow notation
'.' { L _ ITdot }
PREFIX_AT { L _ ITtypeApp }
+ PREFIX_PERCENT { L _ ITpercent } -- for linear types
'{' { L _ ITocurly } -- special symbols
'}' { L _ ITccurly }
@@ -2062,12 +2063,16 @@ type :: { LHsType GhcPs }
>> ams (sLL $1 $> $ HsFunTy noExtField HsUnrestrictedArrow $1 $3)
[mu AnnRarrow $2] }
- | btype '#->' ctype {% hintLinear (getLoc $2) >>
- ams (sLL $1 $> $ HsFunTy noExtField HsLinearArrow $1 $3)
- [mu AnnLolly $2] }
+ | btype mult '->' ctype {% hintLinear (getLoc $2) >>
+ ams (sLL $1 $> $ HsFunTy noExtField (unLoc $2) $1 $4)
+ [mu AnnRarrow $3] }
-mult :: { LHsType GhcPs }
- : btype { $1 }
+ | btype '->.' ctype {% hintLinear (getLoc $2) >>
+ ams (sLL $1 $> $ HsFunTy noExtField HsLinearArrow $1 $3)
+ [mu AnnLollyU $2] }
+
+mult :: { Located (HsArrow GhcPs) }
+ : PREFIX_PERCENT atype { sLL $1 $> (mkMultTy $2) }
btype :: { LHsType GhcPs }
: infixtype {% runPV $1 }
@@ -3823,7 +3828,7 @@ isUnicode (L _ (ITcparenbar iu)) = iu == UnicodeSyntax
isUnicode (L _ (ITopenExpQuote _ iu)) = iu == UnicodeSyntax
isUnicode (L _ (ITcloseQuote iu)) = iu == UnicodeSyntax
isUnicode (L _ (ITstar iu)) = iu == UnicodeSyntax
-isUnicode (L _ (ITlolly iu)) = iu == UnicodeSyntax
+isUnicode (L _ ITlolly) = True
isUnicode _ = False
hasE :: Located Token -> Bool