io/io.bend checks
raw source on the hub · import 0x64e1b9e0466cf913fa57e70aeb11c176/io/io.bend as Io
1 import
import Base
Laws
law text.close provedsource · line 24 · raw
@m:Pair(File, Result<&1, &1, Pair(U32, String), String>) -> IO(Read)
law text.size provedsource · line 46 · raw
@m:Pair(File, Result<&1, &1, Pair(U32, String), U32>) -> @limit:Maybe<&2, U32> -> IO(Read)
law bytes.close provedsource · line 65 · raw
@m:Pair(File, Result<&1, &1, Pair(U32, String), List<&2, U32>>) -> IO(List<&2, U32>)
law bytes.size provedsource · line 76 · raw
@m:Pair(File, Result<&1, &1, Pair(U32, String), U32>) -> IO(List<&2, U32>)
Types
type Read source · line 13 · raw
Data
a read text, or the file's size when it was over the limit
Got@text:String -> Read
TooBig@size:U32 -> Read
Definitions
def over source · line 17 · raw
@limit:Maybe<&2, U32> -> @+n:U32 -> Bool
def text.check source · line 35 · raw
@big:Bool -> @f:File -> @+n:U32 -> IO(Read)
def read_text source · line 59 · raw
@path:String -> @limit:Maybe<&2, U32> -> IO(Read)
the file as text, decoded by the runtime, which turns each bad UTF-8 sequence into U+FFFD; None reads any size
def read_bytes source · line 88 · raw
@path:String -> IO(List<&2, U32>)
the file's bytes as they are (0..255), one list cell each