We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f5d8b19 commit bf8c221Copy full SHA for bf8c221
src/ZMidi/Internal/ParserMonad.fs
@@ -167,13 +167,8 @@ module ParserMonad =
167
fmapM modify parser
168
169
/// Run the parser, if it fails swap the error message.
170
- let inline ( <??> ) (parser : ParserMonad<'a>) (genMessage : Pos -> string) : ParserMonad<'a> =
171
- StateT <| fun st ->
172
- match apply1 parser st with
173
- | Ok result -> Ok result
174
- | Error e ->
175
- logf "oops <??>: e:%A" e
176
- Error(mkOtherParseError st genMessage)
+ let inline ( <??> ) (parser : ParserMonad<'a>) (genMessage : Pos -> string) : ParserMonad<'a> =
+ parser </catch/> fun (ParseError (pos, _)) -> throw <| ParseError (pos, Other (genMessage pos))
177
178
///
179
let fmap (f: 'a -> 'b) (p: ParserMonad<'a>) : ParserMonad<'b> = map f p
0 commit comments