Interaction Trees in Zig and simple benchmarks

This commit is contained in:
2026-05-15 21:41:19 -05:00
parent e3dcf5edd7
commit 8d5e76db1c
17 changed files with 2179 additions and 81 deletions

View File

@@ -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