Interaction Trees in Zig and simple benchmarks
This commit is contained in:
@@ -8,7 +8,8 @@ module IODriver
|
||||
, runIOWith
|
||||
) where
|
||||
|
||||
import Research (T(..), apply, toString, toNumber, ofString, ofNumber)
|
||||
import Research (T(..), apply, toString, toNumber, ofString, ofNumber, ofBytes)
|
||||
import qualified Data.ByteString as BS
|
||||
import System.IO (putStr, getLine)
|
||||
import qualified System.IO as IO
|
||||
import Control.Exception (try, IOException, SomeException)
|
||||
@@ -487,9 +488,9 @@ stepMachine machine =
|
||||
in path == prefix || prefix' `isPrefixOf` path
|
||||
|
||||
tryReadFile path = do
|
||||
result <- try (IO.readFile path) :: IO (Either IOException String)
|
||||
result <- try (BS.readFile path) :: IO (Either IOException BS.ByteString)
|
||||
case result of
|
||||
Right content -> return $ okResult (ofString content)
|
||||
Right content -> return $ okResult (ofBytes content)
|
||||
Left e -> return $ errResult (ioErrorCode e)
|
||||
|
||||
tryWriteFile path contents = do
|
||||
|
||||
Reference in New Issue
Block a user