We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 64c1106 commit 735a8bcCopy full SHA for 735a8bc
src/ZMidi/Internal/ParserMonad.fs
@@ -157,13 +157,8 @@ module ParserMonad =
157
StateT <| fun st -> Error (mkOtherParseError st genMessage)
158
159
/// Run the parser, if it fails swap the error message.
160
- let inline ( <??> ) (parser : ParserMonad<'a>) (genMessage : Pos -> string) : ParserMonad<'a> =
161
- StateT <| fun st ->
162
- match apply1 parser st with
163
- | Ok result -> Ok result
164
- | Error e ->
165
- logf "oops <??>: e:%A" e
166
- 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))
167
168
///
169
let fmap (f: 'a -> 'b) (p: ParserMonad<'a>) : ParserMonad<'b> = map f p
0 commit comments