@@ -6,7 +6,6 @@ module ParserMonad =
66 open System.IO
77 open FSharpPlus
88 open FSharpPlus.Data
9- open ZMidi.Internal .Utils
109
1110 /// Status is either OFF or the previous VoiceEvent * Channel.
1211 type VoiceEvent =
@@ -130,15 +129,7 @@ module ParserMonad =
130129 )
131130 )
132131
133- let inline mreturn ( x : 'a ) : ParserMonad < 'a > =
134- StateT <| fun st -> Ok ( x, st)
135-
136- let inline private bindM ( parser : ParserMonad < 'a >)
137- ( next : 'a -> ParserMonad < 'b >) : ParserMonad < 'b > =
138- StateT <| fun state ->
139- match apply1 parser state with
140- | Error msg -> Error msg
141- | Ok ( ans, st1) -> apply1 ( next ans) st1
132+ let inline mreturn ( x : 'a ) : ParserMonad < 'a > = result x
142133
143134 let mzero () : ParserMonad < 'a > =
144135 StateT <| fun state -> Error ( mkParseError state ( EOF " mzero" ))
@@ -149,14 +140,7 @@ module ParserMonad =
149140 | Error _ -> apply1 parser2 state
150141 | Ok res -> Ok res
151142
152- let inline private delayM ( fn : unit -> ParserMonad < 'a >) : ParserMonad < 'a > =
153- bindM ( mreturn ()) fn
154-
155143 let inline mfor ( items : #seq<'a> ) ( fn : 'a -> ParserMonad < 'b >) : ParserMonad < seq < 'b >> = failwithf " "
156-
157-
158- let (>>= ) ( m: ParserMonad< 'a>) ( k: 'a -> ParserMonad< 'b>) : ParserMonad< 'b> =
159- bindM m k
160144
161145 let parseMidi = monad
162146
@@ -193,17 +177,8 @@ module ParserMonad =
193177 Error( mkOtherParseError st genMessage)
194178
195179 ///
196- let fmap ( f : 'a -> 'b ) ( p : ParserMonad < 'a >) : ParserMonad < 'b > =
197- parseMidi {
198- let! a = p
199- return ( f a)
200- }
180+ let fmap ( f : 'a -> 'b ) ( p : ParserMonad < 'a >) : ParserMonad < 'b > = map f p
201181 let inline ( < ~> (* <$> *) ) ( a ) b = fmap a b
202- let ( *> ) ( a : ParserMonad < 'a >) ( b : 'a -> ParserMonad < 'b >) : ParserMonad < 'b > =
203- parseMidi {
204- let! a = a
205- return ! ( b a)
206- }
207182
208183 // http://hackage.haskell.org/package/base-4.12.0.0/docs/src/GHC.Base.html#%3C%24
209184 /// Replace all locations in the input with the same value.
0 commit comments