~/bend-docscommunity

src/lsp/files/disk.bend relies on unsafe/foreign

raw source on the hub · import bolt@1.28.0.0/src/lsp/files/disk.bend as Disk

files/disk: the real file system. Reads bytes and decodes them itself, as a chunk may end inside a UTF-8 char. The slurp's acc holds the bytes read so far last first: each chunk is pushed onto its front and the whole is reversed once at the end, since appending a chunk copied everything read before it (concat).

4 imports
import Base
import ./service.bend as S
import ../frame.bend as Frame
import ../../walk/disk.bend as WalkDisk

Definitions

def slurp.end source · line 11 · raw

@file:File -> @acc:List<&2, U32> -> IO(Maybe<&2, String>)

def slurp.cut source · line 16 · raw

@bytes:List<&2, U32> -> @file:File -> @acc:List<&2, U32> -> @rest:(@_:File -> @_:List<&2, U32> -> IO(Maybe<&2, String>)) -> IO(Maybe<&2, String>)

def slurp.more source · line 28 · raw

@rr:Result<&1, &1, Pair(U32, String), List<&2, U32>> -> @file:File -> @acc:List<&2, U32> -> @rest:(@_:File -> @_:List<&2, U32> -> IO(Maybe<&2, String>)) -> IO(Maybe<&2, String>)

def slurp.next source · line 40 · raw

@got:Pair(File, Result<&1, &1, Pair(U32, String), List<&2, U32>>) -> @acc:List<&2, U32> -> @rest:(@_:File -> @_:List<&2, U32> -> IO(Maybe<&2, String>)) -> IO(Maybe<&2, String>)

def slurp source · line 49 · raw

@fuel:Nat -> @file:File -> @acc:List<&2, U32> -> IO(Maybe<&2, String>)

the whole file, read in chunks until one is empty, or the fuel is

def read.opened source · line 58 · raw

@rr:Result<&1, &1, Pair(U32, String), File> -> IO(Maybe<&2, String>)

def read source · line 66 · raw

@path:String -> IO(Maybe<&2, String>)

a file's text, or None when it cannot be opened

def base_path.of source · line 71 · raw

@rr:Result<&1, &1, Pair(U32, String), String> -> IO(String)

def base_path source · line 79 · raw

@_u:Unit -> IO(String)

Base, where bend's installer puts it

def cwd source · line 85 · raw

@_u:Unit -> IO(String)

the working directory, as the lint's walk names it

def entries source · line 89 · raw

@dir:String -> IO(List<&2, String>)

a directory's entries, as the lint's walk lists them

def new source · line 93 · raw

0x728a7481f2db8993629966a5c5823bab/src/lsp/files/service.Files

the real file system