@@ -39,6 +39,15 @@ export
3939plhs : ParseOpts
4040plhs = MkParseOpts False False
4141
42+ leftArrow : Rule ()
43+ leftArrow = symbol " <-" <|> symbol " ←"
44+
45+ rightArrow : Rule ()
46+ rightArrow = symbol " ->" <|> symbol " →"
47+
48+ doubleRightArrow : Rule ()
49+ doubleRightArrow = symbol " =>" <|> symbol " ⇒"
50+
4251atom : FileName -> Rule PTerm
4352atom fname
4453 = do start <- location
@@ -424,12 +433,11 @@ mutual
424433
425434 bindSymbol : Rule (PiInfo PTerm)
426435 bindSymbol
427- = do symbol " -> "
436+ = do rightArrow
428437 pure Explicit
429- <|> do symbol " => "
438+ <|> do doubleRightArrow
430439 pure AutoImplicit
431440
432-
433441 explicitPi : FileName -> IndentInfo -> Rule PTerm
434442 explicitPi fname indents
435443 = do start <- location
@@ -449,7 +457,7 @@ mutual
449457 commit
450458 binders <- pibindList fname start indents
451459 symbol " }"
452- symbol " -> "
460+ rightArrow
453461 scope <- typeExpr pdef fname indents
454462 end <- location
455463 pure (pibindAll (MkFC fname start end) AutoImplicit binders scope)
@@ -463,7 +471,7 @@ mutual
463471 t <- simpleExpr fname indents
464472 binders <- pibindList fname start indents
465473 symbol " }"
466- symbol " -> "
474+ rightArrow
467475 scope <- typeExpr pdef fname indents
468476 end <- location
469477 pure (pibindAll (MkFC fname start end) (DefImplicit t) binders scope)
@@ -489,7 +497,7 @@ mutual
489497 symbol " {"
490498 binders <- pibindList fname start indents
491499 symbol " }"
492- symbol " -> "
500+ rightArrow
493501 scope <- typeExpr pdef fname indents
494502 end <- location
495503 pure (pibindAll (MkFC fname start end) Implicit binders scope)
@@ -499,7 +507,7 @@ mutual
499507 = do start <- location
500508 symbol " \\ "
501509 binders <- bindList fname start indents
502- symbol " => "
510+ doubleRightArrow
503511 mustContinue indents Nothing
504512 scope <- expr pdef fname indents
505513 end <- location
@@ -602,7 +610,7 @@ mutual
602610
603611 caseRHS : FileName -> FilePos -> IndentInfo -> PTerm -> Rule PClause
604612 caseRHS fname start indents lhs
605- = do symbol " => "
613+ = do doubleRightArrow
606614 mustContinue indents Nothing
607615 rhs <- expr pdef fname indents
608616 atEnd indents
@@ -639,7 +647,7 @@ mutual
639647
640648 field : FileName -> IndentInfo -> Rule PFieldUpdate
641649 field fname indents
642- = do path <- sepBy1 (symbol " -> " ) unqualifiedName
650+ = do path <- sepBy1 rightArrow unqualifiedName
643651 upd <- (do symbol " =" ; pure PSetField )
644652 <|>
645653 (do symbol " $=" ; pure PSetFieldApp )
@@ -681,7 +689,7 @@ mutual
681689 -- If the name doesn't begin with a lower case letter, we should
682690 -- treat this as a pattern, so fail
683691 validPatternVar n
684- symbol " <- "
692+ leftArrow
685693 val <- expr pdef fname indents
686694 atEnd indents
687695 end <- location
@@ -707,7 +715,7 @@ mutual
707715 (do atEnd indents
708716 end <- location
709717 pure [DoExp (MkFC fname start end) e])
710- <|> (do symbol " <- "
718+ <|> (do leftArrow
711719 val <- expr pnowith fname indents
712720 alts <- block (patAlt fname)
713721 atEnd indents
@@ -1157,15 +1165,15 @@ getRight (Right v) = Just v
11571165constraints : FileName -> IndentInfo -> EmptyRule (List (Maybe Name, PTerm))
11581166constraints fname indents
11591167 = do tm <- appExpr pdef fname indents
1160- symbol " => "
1168+ doubleRightArrow
11611169 more <- constraints fname indents
11621170 pure ((Nothing , tm) :: more)
11631171 <|> do symbol " ("
11641172 n <- name
11651173 symbol " :"
11661174 tm <- expr pdef fname indents
11671175 symbol " )"
1168- symbol " => "
1176+ doubleRightArrow
11691177 more <- constraints fname indents
11701178 pure ((Just n, tm) :: more)
11711179 <|> pure []
@@ -1179,7 +1187,7 @@ implBinds fname indents
11791187 symbol " :"
11801188 tm <- expr pdef fname indents
11811189 symbol " }"
1182- symbol " -> "
1190+ rightArrow
11831191 more <- implBinds fname indents
11841192 pure ((n, rig, tm) :: more)
11851193 <|> pure []
0 commit comments