File tree Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Original file line number Diff line number Diff line change @@ -94,10 +94,7 @@ module ParserMonad =
94
94
95
95
/// Run the parser on a file.
96
96
let runParseMidi ( ma : ParserMonad < 'a >) ( inputPath : string ) : Result < 'a , ParseError > =
97
- use stream = File.Open( path = inputPath, mode = FileMode.Open, access = FileAccess.Read)
98
- use memory = new MemoryStream()
99
- stream.CopyTo( memory)
100
- let input : byte [] = memory.ToArray()
97
+ let input = File.ReadAllBytes inputPath
101
98
match apply1 ma input { Position = 0 ; RunningStatus = StatusOff} with
102
99
| Ok ( ans, _) -> Ok ans
103
100
| Error msg -> Error msg
@@ -181,7 +178,7 @@ module ParserMonad =
181
178
let inline boundRepeat ( n : ^T ) ( p : ParserMonad < 'a >) : ParserMonad < 'a array > =
182
179
parseMidi {
183
180
let l = Array.zeroCreate ( int n) // can't use array expression inside a CE (at least as is)
184
- for ( i: 'T ) in LanguagePrimitives .GenericZero .. ( n - LanguagePrimitives .GenericOne ) do
181
+ for ( i: 'T ) in LanguagePrimitives .GenericZero < 'T > .. ( n - LanguagePrimitives .GenericOne < 'T > ) do
185
182
let! r = p
186
183
l.[ int i] <- r
187
184
return l
You can’t perform that action at this time.
0 commit comments