NovelIO


IO

Namespace: NovelFS.NovelIO

Pure IO Functions

Nested types and modules

TypeDescription
IOBuilder

Computation Expression builder for IO actions

ModuleDescription
Loops

IO looping constructs

Operators
Parallel

Parallel IO combinators

Functions and values

Function or valueDescription
apply f x
Signature: f:IO<('a -> 'b)> -> x:IO<'a> -> IO<'b>
Type parameters: 'a, 'b

Takes an IO action which produces a function that maps from a value to another value and an IO action which produces the first value, producing a new IO action which produces the second value. This is like map but the mapping function is contained within IO.

awaitTask task
Signature: task:Task<'?7368> -> IO<'?7368>
Type parameters: '?7368

Allows the awaiting of a result from a forked Task

bind x f
Signature: x:IO<'?7326> -> f:('?7326 -> IO<'?7327>) -> IO<'?7327>
Type parameters: '?7326, '?7327

Monadic bind for IO action, this is used to combine and sequence IO actions

bracket act fClnUp fBind
Signature: act:IO<'b> -> fClnUp:('b -> IO<'c>) -> fBind:('b -> IO<'d>) -> IO<'d>
Type parameters: 'b, 'c, 'd

Allows you to supply an effect which acquires acquires a resource, an effect which releases that research and an action to perform during the resource's lifetime

chooseM mFunc sequ
Signature: mFunc:('?7373 -> IO<'?7374 option>) -> sequ:'?7373 list -> IO<'?7374 list>
Type parameters: '?7373, '?7374

Map each element of a list to a monadic action of options, evaluate these actions from left to right and collect the results which are 'Some' as a sequence.

filterM pred sequ
Signature: pred:('?7376 -> IO<bool>) -> sequ:'?7376 list -> IO<'?7376 list>
Type parameters: '?7376

Filters a sequence based upon a monadic predicate, collecting the results as a sequence

foldM accFunc acc sequ
Signature: accFunc:('?7381 -> '?7382 -> IO<'?7381>) -> acc:'?7381 -> sequ:'?7382 list -> IO<'?7381>
Type parameters: '?7381, '?7382

Analogous to fold, except that the results are encapsulated within IO

forkIO io
Signature: io:IO<'a> -> IO<unit>
Type parameters: 'a

Allows a supplied IO action to be executed on the thread pool

forkTask io
Signature: io:IO<'a> -> IO<Task<'a>>
Type parameters: 'a

Allows a supplied IO action to be executed on the thread pool, returning a task from which you can observe the result

fromEffectful f
Signature: f:(unit -> 'a) -> IO<'a>
Type parameters: 'a

Creates an IO action from an effectful computation, this simply takes a side effecting function and brings it into IO

iterM mFunc sequ
Signature: mFunc:('a -> IO<'b>) -> sequ:seq<'a> -> IO<unit>
Type parameters: 'a, 'b

Map each element of a list to a monadic action, evaluate these actions from left to right and ignore the results.

join x
Signature: x:IO<IO<'?7331>> -> IO<'?7331>
Type parameters: '?7331

Removes a level of IO structure

lift2 f x1 x2
Signature: f:('?7356 -> '?7357 -> '?7358) -> x1:IO<'?7356> -> x2:IO<'?7357> -> IO<'?7358>
Type parameters: '?7356, '?7357, '?7358

Takes a function which transforms two values in another value and two IO actions which produce the first two values, producing a new IO action which produces the result of the function application

liftAsync a
Signature: a:Async<'a> -> IO<'a>
Type parameters: 'a

Lift an async computation into IO

map f x
Signature: f:('?7348 -> '?7349) -> x:IO<'?7348> -> IO<'?7349>
Type parameters: '?7348, '?7349

Takes a function which transforms a value to another value and an IO action which produces the first value, producing a new IO action which produces the second value

pure' x
Signature: x:'?7354 -> IO<'?7354>
Type parameters: '?7354

Lift a value into IO. Equivalent to return.

repeatM mFunc n
Signature: mFunc:IO<'?7388> -> n:int -> IO<unit>
Type parameters: '?7388

As replicateM but ignores the results

replicateM mFunc n
Signature: mFunc:IO<'?7386> -> n:int -> IO<'?7386 list>
Type parameters: '?7386

Performs the action mFunc n times, gathering the results.

return' x
Signature: x:'?7322 -> IO<'?7322>
Type parameters: '?7322

Return a value as an IO action

run io
Signature: io:IO<'?7320> -> '?7320
Type parameters: '?7320

Runs the IO actions and evaluates the result

sequence seq
Signature: seq:IO<'?7384> list -> IO<'?7384 list>
Type parameters: '?7384

Evaluate each action in the list from left to right and collect the results as a list.

traverse mFunc lst
Signature: mFunc:('?7370 -> IO<'?7371>) -> lst:'?7370 list -> IO<'?7371 list>
Type parameters: '?7370, '?7371

Map each element of a list to a monadic action, evaluate these actions from left to right and collect the results as a sequence.

Fork me on GitHub