Skip to content

Commit

Permalink
Lexer: Remove polymorphic effect
Browse files Browse the repository at this point in the history
  • Loading branch information
marzipankaiser committed Oct 20, 2023
1 parent d810c54 commit 6154108
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/casestudies/lexer.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def example1() = {
## Handling the Lexer Effect with a given List
A dummy lexer reading lexemes from a given list can be implemented as a handler for the `Lexer` effect. The definition uses the effect `LexerError` to signal the end of the input stream:
```
effect LexerError[A](msg: String, pos: Position): A
effect LexerError(msg: String, pos: Position): Nothing
def dummyPosition() = Position(0, 0, 0)
def lexerFromList[R](l: List[Token]) { program: => R / Lexer }: R / LexerError = {
Expand All @@ -94,7 +94,7 @@ def lexerFromList[R](l: List[Token]) { program: => R / Lexer }: R / LexerError =
We define a separate handler to report lexer errors to the console:
```
def report { prog: => Unit / LexerError }: Unit =
try { prog() } with LexerError[A] { (msg, pos) =>
try { prog() } with LexerError { (msg, pos) =>
println(pos.line.show ++ ":" ++ pos.col.show ++ " " ++ msg)
}
```
Expand Down

0 comments on commit 6154108

Please sign in to comment.