A type-lifting function wraps a value of type T in a corresponding monadic type M<T>. Conventionally called Unit, it creates the simplest workflow that carries the monad’s added capability without changing the underlying value. section 11.1
static Nullable<T> NullableUnit<T> where T : struct (T t) =>
new Nullable<T>(t);
static Lazy<T> LazyUnit<T>(T t) => new Lazy<T>(t);
static Task<T> TaskUnit<T>(T t) => Task.FromResult(t);
static IEnumerable<T> SeqUnit<T>(T t) => [ t ];
These C# definitions lift one value into nullable, lazy, asynchronous, or sequence workflows. section 11.1
Typical lifts preserve the value while choosing a workflow representation:
- NullableUnit turns a struct value into Nullable<T>, adding the possibility of no value. section 11.1
- LazyUnit creates Lazy<T>, deferring computation represented by the wrapped value. section 11.1
- TaskUnit creates an already-completed Task<T>, placing a value into an asynchronous workflow. section 11.1
- SeqUnit creates a one-element IEnumerable<T>, representing the value as a sequence. section 11.1
Unit is necessary but not sufficient for useful composition. Bind combines an M<T> with a function from T to M<R>; Unit and Bind together support workflows that retain ordinary function meanings while adding nullability, laziness, asynchrony, or sequencing. Map can then be defined by binding a function and lifting its result. section 11.3
A probability wrapper
A discrete distribution can provide a Unit wrapper for a single value and Bind for combining it with likelihood-producing functions. This supports principled manipulation of finite categorical distributions rather than ad hoc use of Random. section 14.4



