F# lazy eval from stream reader?
问题 I'm running into a bug in my code that makes me think that I don't really understand some of the details about F# and lazy evaluation. I know that F# evaluates eagerly and therefore am somewhat perplexed by the following function: // Open a file, then read from it. Close the file. return the data. let getStringFromFile = File.OpenRead("c:\\eo\\raw.txt") |> fun s -> let r = new StreamReader(s) let data = r.ReadToEnd r.Close() s.Close() data When I call this in FSI: > let d = getStringFromFile(