From 61541082d2602f56c72d2e64710b0da3f7c8eec0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcial=20Gai=C3=9Fert?= Date: Fri, 20 Oct 2023 09:38:11 +0200 Subject: [PATCH] Lexer: Remove polymorphic effect --- examples/casestudies/lexer.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/casestudies/lexer.md b/examples/casestudies/lexer.md index f6ac315287..dd1bdf48e7 100644 --- a/examples/casestudies/lexer.md +++ b/examples/casestudies/lexer.md @@ -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 = { @@ -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) } ```