Ships in dotnet. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Covers LanguageExt types and operations, from result types and conversions to shared state.
[REFERENCES]:
Result, effect, and collection types come from LanguageExt.Core, host runtimes from LanguageExt.Sys, streams from LanguageExt.Streaming, and JSON converters from LanguageExt.Json. using static LanguageExt.Prelude brings constructors and module functions into scope. Resolve name collisions where imports and declarations meet.
Result and effect types and their runtime shapes:
| [INDEX] | [TYPE] | [SHAPE] |
|---|---|---|
| [01] | Option<A> | readonly struct |
| [02] | Fin<A> | abstract class |
| [03] | Either<L, R> | abstract record class |
| [04] | Validation<Error, A> | abstract record class |
| [05] | Try<A> | record class |
| [06] | IO<A> | abstract record class |
| [07] | Eff<RT, A> | record class |
Each type exposes Match with one function per case:
Match on IO and Eff returns an effectOption<A> holds a flag and an inner value, exposes the flag as IsSome and IsNone, and ignores the inner value in the None stateOption<A> and Fin<A> are closed, a Match over their cases is totalA maps null to None, Optional(x) does the same for nullable input, Some(x) wraps the value as givenToNullable() turns a value-element Option into A?ValueUnsafe() from LanguageExt.UnsafeValueAccess turns a reference-element Option into A? at the host boundaryOption<A> defines operator true, left || right evaluates the right operand only when the left is None, left | right evaluates bothIfNone(A) takes a value, IfNone(Func<A>) takes a computation that runs only on None, both return AMatch returning one case unchanged is IfNone, IfFail, IfLeft, or IfRightPrelude forms match(option, Some, None), ifNone(option, Func<A>), and ifNone(option, A) compile unqualified and qualifiedNone slot of match are CS0201Fin has no module form, match(fin, Succ:, Fail:) and ifFail(fin, f) resolve to the Eff overloads (CS0411, CS0029)Each conversion is a method on the source type named for the target, and converting from Option requires the Error it lacks:
internal static class Conversions {
public static Fin<int> Required(Option<int> value) => value.ToFin(Fault.Of(Reason.Missing, "count"));
public static Validation<Error, int> Checked(Option<int> value) => value.ToValidation<Error>(Fault.Of(Reason.Missing, "count"));
public static Either<Error, Quantity> Split(Fin<Quantity> quantity) => quantity.ToEither();
public static Seq<int> Items(Option<int> value) => value.ToSeq();
public static Fin<Item> Exit(Validation<Error, Item> form) => form.ToFin();
public static Validation<Error, Quantity> Widen(Fin<Quantity> quantity) => quantity.ToValidation();
public static Fin<int> Captured(Try<int> attempt) => attempt.Run();
public static Fin<Item> Ran(IO<Item> effect) => effect.RunSafe();
public static Fin<string> Answered(AppRuntime runtime) => Prompts.Ask<AppRuntime>("name").Run(runtime);
}
ToOption on a Fin drops the failure reasonFin values combine under tuple Apply or Traverse and accumulate every error, Bind and TraverseM stop at the firstTry, IO, and Eff return Fin when runOption<A>, Seq<A>, and Fin<A> share the operation names and Seq<A> has no Pure. LINQ names Map as Select, Bind as SelectMany, and Filter as Where:
| [INDEX] | [OPERATION] | [SIGNATURE] | [BEHAVIOR] |
|---|---|---|---|
| [01] | Pure | A -> F<A> | Lifts a plain value, converts into Option, Fin, and IO |
| [02] | Map | (F<A>, A -> B) -> F<B> | Applies the function to each value and preserves F |
| [03] | Bind | (F<A>, A -> F<B>) -> F<B> | Applies the function and flattens the nested result |
| [04] | Filter | (F<A>, A -> bool) -> F<A> | Keeps the values that satisfy the predicate |
| [05] | Iter | (F<A>, Action<A>) -> Unit | Runs the action for each value at once and returns Unit |
| [06] | Do | (F<A>, Action<A>) -> F<A> | Runs the action for each value and returns the input |
Map on Option applies the function once for Some and never for None, on Seq lazily to every elementBind on Option skips the function after None, on Seq concatenates every produced sequence into oneFilter on Option turns a failed predicate into None, LINQ where works the sameIter has its own name, overload resolution cannot distinguish Action<A> from Func<A, B> by return typeFin<A> supplies IfSucc in place of Do, a side effect inside IO is a bound IO.lift step, Map and let hold bodies with no call or side effectNone or a failure no later action runsToSeq converts an option to a zero-or-one-element sequence, Flatten on the ToSeq of an Option<Seq<A>> yields the Seq<A>Values in context have type F<A>, and the type constructor supplies the computational effect:
Option adds absence, Seq zero or more values, Func<A> deferred evaluationFin adds expected failure with a reason, IO a deferred side effect with a failure channelA from every F<A>. Match, Count, Fold, IfNone, and RunSafe are the type-specific extractionsUse dotnet:coding for error type design.
Error.New creates an error from a message, and package error records extend Expected:
Error.New(string) and Error.New(string, Error) create an Expected with code 0, the second holding its cause as InnerError.New(int, string) creates an Expected under that code, Errors.ParseError(string) one under ErrorCodes.ParseErrorErrors holds shared values with fixed messages (Cancelled, TimedOut, Closed, ValidationFailed, None), ErrorCodes their codesError.New(Exception) maps a cancellation to Errors.Cancelled, a timeout to Errors.TimedOut, and an AggregateException to ManyErrorsError.New(Exception) returns an ErrorException's own Error and an Exceptional for any other exception, Try and IO capture through itError.New(string, Exception) creates an Exceptional with that messageManyErrors is the error + produces, Validation and Fin accumulate through itIs, HasCode, value Catch, and @catch compare nonzero codes across packages, package code enums numbered from 1 collideIs and value Catch compare the message of a code-0 errorinternal static class Classify {
public static bool Retryable(Error error) => error.Is(Errors.TimedOut) || error.HasException<IOException>();
public static bool IsRejection(Error error) => error.HasCode(ErrorCodes.ValidationFailed) || error.IsType<Fault<Reason>>();
public static int Faults(Error error) => error.Filter<Fault<Reason>>().Count;
public static Option<Error> Cause(Error error) => error.Filter<Fault<Reason>>().Head is Fault<Reason> fault ? fault.Inner : None;
}
IsType<E> tests and Filter<E> selects the E leaves of a ManyErrors, returning the one leaf, a ManyErrors of the leaves, or Errors.NoneError miss those leaves, IsExpected and IsExceptional test the error caseCount returns the number of leaves, Head the first leaf, Errors.None holds no leaf and is its own HeadFilter<E>().Head is E <case> binds the first E leaf to read its fields, Errors.None fails the patternHasCode and Catch(int) select a LanguageExt code (ErrorCodes.ValidationFailed, ErrorCodes.ParseError), IsType<E> a package's typed failureInner reuse Expected.Inner when typed Option<Error>, any other type fails CS8866IsType, HasCode, HasException, Is, and Catch do not descend into Inner, only the typed record that wraps a cause stays classifiableError implements Monoid<Error>, a custom failure type implements Monoid<F> before Validation<F, A> accumulates it& on operands with one success type collects the successes into Seq<A> and accumulates the failuresRecovery is a function from an error to the same result type, and the overloads select the error by code, by value, or by predicate:
internal static class Recovery {
public static Fin<Quantity> ByCode(Fin<Quantity> quantity) => quantity.Catch(ErrorCodes.ValidationFailed, static _ => Zero).As();
public static Fin<Quantity> ByValue(Fin<Quantity> quantity) => quantity.Catch(Errors.TimedOut, static _ => Zero).As();
public static IO<string> Read(string path) =>
IO.lift(() => File.ReadAllText(path)).Catch(static error => error.HasException<FileNotFoundException>(), error => IO.fail<string>(Fault.Of(Reason.Missing, path, inner: error)));
public static IO<Item> Cached(IO<Item> load, Item cached) => load | @catch(static error => error.IsType<Fault<Reason>>(), _ => IO.pure(cached));
public static IO<Item> Fallback(IO<Item> primary, IO<Item> secondary) => primary | secondary;
public static Fin<Quantity> Rebound(Fin<Quantity> quantity) => quantity.BindFail(static error => error.HasCode(ErrorCodes.ValidationFailed) ? Zero : error);
public static Fin<Quantity> WithContext(Fin<Quantity> quantity) => quantity.MapFail(static error => Fault.Of(Reason.Invalid, "quantity", inner: error));
public static int AtHost(Fin<int> result, int failure) => result.IfFail(_ => failure);
private static Fin<Quantity> Zero => Quantity.Validated(0);
}
Catch are extensions that return K<F, A>, .As() restores the concrete typeCatch(<handler>), CatchIO, and @catch(<handler>) recover from every error, and a predicate that accepts every error restates themIO<A> declares the predicate overload as an instance method that returns IO<A>IO values that failed at construction run the predicate overload's handler for every error, io | @catch(<predicate>, <handler>) tests the predicateCatch receives the failure of every step in its receiver, a Catch on the throwing call recovers that call alone| uses the right alternative when the left failsBindFail lets the recovery return either case, MapFail changes only the error, BiMap maps both sides, IfFail returns a plain valueIn a LINQ query, guard raises an Error when its flag is false:
when runs its alternative when the flag is true, unless when the flag is falsewhen(<condition>, <effect>).As() or unlessFin<Unit> or IO<Unit>guard<Error> names the type argument, an Expected subclass argument selects the generic overload guard<E>(bool, E)internal static class Guards {
public static Fin<int> Even(string text) =>
from value in parseInt(text).ToFin(Errors.ParseError(text))
from _ in guard<Error>(int.IsEvenInteger(value), Odd(value))
select value;
public static IO<int> Metered(IO<int> read) =>
from v in read
from _ in unless(int.IsEvenInteger(v), IO.fail<Unit>(Odd(v)))
select v;
private static Fault<Reason> Odd(int value) => Fault.Of(Reason.Invalid, value);
}
IO.lift reads the return type of its thunk to select an overload:
Func<A> defers the value, Func<Fin<A>> converts a Fail to an IO failureIO.lift(Fin<A>) lifts an evaluated result, as does IO.lift(Next) over a Fin<A> Next() method groupFin<A> has no ToIOFin values lift through .Bind(IO.lift) or from x in IO.lift(fin), each typed IO<A>dotnet format reports IDE0001 where dotnet build does notFin<T> (x) =>), single-overload members, method groups, and query clauses bind onceIO.lift over the conditional or Switch with arms returning a Fin or valueinternal static class Construction {
public static IO<int> Plain => IO.lift(static () => 1);
public static IO<int> Folded => IO.lift(static () => Quantity.Validated(2).Map(static q => (int)q));
public static IO<int> TokenAware => IO.liftAsync(static env => Remote.FetchAsync(6, env.Token));
}
Run and RunAsync represent an Expected error as an ErrorException and rethrow the exception an Exceptional error capturedTry.lift(io.Run).Run() captures the thrown error and returns the original ExpectedEnvIO.New(token:) passes the cancellation token into Run(env)RunSafe as an exception that a host captures with Try.liftTry.lift and IO.lift wrap the one throwing call, a block body captures every call in it as Exceptionaluse(Func<A>) acquires an IDisposable inside the effect and disposes it when the scope ends on either path:
use(Func<A>, Action<A>) names the release step and runs it on every exitBracket(Use:, Fin:) attaches Finally to the effect returned by UseFinally attaches an effect that runs after a deferred receiver on both paths, an IO.fail receiver returns itself without itBracket() with no arguments releases every use inside its receiver and sits on the expression that starts at the scope's first useinternal static class Leases {
public static IO<int> Released =>
(from connection in use(static () => new Connection())
select connection.Query()).Bracket();
public static IO<int> Audited(IO<int> work, Atom<int> closed) =>
(from _ in use(static () => unit, _ => IO.lift(() => ignore(closed.Swap(static n => n + 1))))
from value in work
select value).Bracket();
}
Fork starts the effect on one TaskCreationOptions.LongRunning thread and returns a ForkIO with Await and Cancel:
awaitAll runs every effect of a Seq<IO<A>> and collects the values, awaitAny returns the first valuetimeout(duration, effect) fails the effect after the duration, Uninterruptible masks cancellationPartitionFallible takes a Seq<K<IO, A>> (Map<K<IO, A>> sets that element type) and runs every effect without a short-circuitPartitionFallible returns (Seq<Error> Fails, Seq<A> Succs), Succs and Fails return one sidePartitionFallible serves a caller that keeps Succs beside Fails, Traverse under IO fails whole with one errorTraverse under IO starts every element effect before awaiting anyIO.liftAsync overlap without a bound, effects built with IO.lift run in order on the calling thread until the first failureTraverseMValidationT over IO applies serially, FinT<IO> Apply and Traverse run their effects concurrently and join errorsConduit reduced under ForkAsyncSemaphore.EnterAsync() under use serializes access, host dispatchers supply thread affinityinternal static class Concurrency {
public static IO<Seq<int>> Chunked(Seq<int> items, int width, Func<int, IO<int>> work) =>
toSeq(items.Chunk(width))
.TraverseM(chunk => toSeq(chunk).Traverse(work).As())
.As()
.Map(static chunks => chunks.Flatten());
public static IO<(Seq<Error> Fails, Seq<int> Succs)> BestEffort(Seq<int> items, Func<int, IO<int>> work) =>
items.Map<K<IO, int>>(item => work(item)).PartitionFallible().As();
}
tail marks the last bind continuation after a deferred effect and keeps the stack constant:
tail-recursive IO exits through Run() or RunAsync() aloneRunSafe(), Try(), Map, or a later Bind after the tail call throws NotSupportedExceptionMonad.recur<M, A, B> loops a state A with Next.Loop<A, B> and finishes with Next.Done<A, B> holding a BMonad.recur works with every host operation and returns K<IO, B> that .As() narrowsMonad.recur checks the state before it advances, an already-finished initial state returns unchangedRepeatUntil polls one effect until its value satisfies the predicate, RepeatWhile polls while it doesSome are RepeatUntil(Schedule.spaced(d), static x => x.IsSome), Monad.recur over IO.yieldFor restates themRepeat or Retry over the same scheduleinternal static class Recursion {
public static IO<int> CountTo(int current, int limit) =>
current >= limit ? IO.pure(current) : IO.lift(() => current + 1).Bind(next => tail(CountTo(next, limit)));
public static IO<Session> Play(Session initial, IO<int> readMove) =>
Monad.recur<IO, Session, Session>(initial, session =>
session.HasExited
? IO.pure(Next.Done<Session, Session>(session))
: readMove.Map(move => Next.Loop<Session, Session>(session.Apply(move)))).As();
public static IO<int> Poll(Atom<int> polls, int limit) => IO.lift(() => polls.Swap(static n => n + 1)).RepeatUntil(n => n >= limit);
}
Schedule.spaced and Schedule.exponential build delay sequences:
recurs, repeat, jitter, and maxDelay are ScheduleTransformer valuesrecurs caps the attempt count, repeat replays the whole schedule, jitter randomizes each delay, maxDelay caps each delayLanguageExt.Duration, with an implicit conversion from the TimeSpan a NodaTime Duration returns through ToTimeSpan()| is a union that takes the shorter delay and & an intersection that takes the longerSchedule.Forever with the transformer appliedRetry(Schedule) reruns a deferred effect that failed, Repeat(Schedule) reruns a successful oneRepeat(Schedule.recurs(n)) runs the effect once and then n more timesinternal static class Schedules {
public static Schedule Backoff(Duration seed, int attempts) => Schedule.exponential(seed.ToTimeSpan()) | Schedule.recurs(attempts) | Schedule.jitter();
public static Schedule Capped(Duration seed, Duration ceiling) => Schedule.exponential(seed.ToTimeSpan()) & Schedule.maxDelay(ceiling.ToTimeSpan());
public static Schedule Replayed(Duration spacing, int attempts, int passes) => Schedule.spaced(spacing.ToTimeSpan()) | Schedule.recurs(attempts) | Schedule.repeat(passes);
}
Runtime records implement Has<Eff<RT>, T> once per capability with Eff.runtime<RT>().Map(static rt => rt.Capability):
RT read the capability through RT.Ask or through a module constrained on the traitConsole<RT>.writeLine and Console<RT>.readLine need ConsoleIO, File<RT> needs FileIO and EncodingIORun(rt) returns Fin<A>, RunAsync(rt) returns Task<Fin<A>>internal sealed record AppRuntime(ConsoleIO Console) : Has<Eff<AppRuntime>, ConsoleIO> {
static K<Eff<AppRuntime>, ConsoleIO> Has<Eff<AppRuntime>, ConsoleIO>.Ask => Eff.runtime<AppRuntime>().Map(static rt => rt.Console);
}
internal static class Prompts {
public static Eff<RT, string> Ask<RT>(string prompt) where RT : Has<Eff<RT>, ConsoleIO> =>
from _ in Console<RT>.writeLine(prompt)
from line in Console<RT>.readLine
select line;
}
LanguageExt.Sys.Live.Runtime.New() supplies the live host servicesK<F, A> is an empty interface that pairs the witness F for a type constructor with the element type A:
Option<A> implements K<Option, A> and Either<L, R> implements K<Either<L>, R>.As() restores the concrete type at the API boundaryinternal static class Generic {
public static K<F, decimal> Amounts<F>(K<F, Item> items) where F : Functor<F> => items.Map(static item => item.Amount);
public static Option<decimal> OptionAmount(Option<Item> item) => Amounts(item).As();
public static Seq<decimal> SeqAmounts(Seq<Item> items) => Amounts(items).As();
}
| [INDEX] | [TRAIT] | [MEMBERS] |
|---|---|---|
| [01] | Functor<F> | Map |
| [02] | Applicative<F> | Pure, Apply, tuple Apply |
| [03] | Monad<M> | Bind, LINQ query syntax |
| [04] | Foldable<T> | Fold, FoldBack, Exists, ForAll, At |
| [05] | Traversable<T> | Traverse, TraverseM |
| [06] | Fallible<E, F> | Fail, Catch |
| [07] | Readable<M, Env> | ask, asks, local |
| [08] | Stateful<M, S> | get, put, modify, state, local |
| [09] | Writable<M, W> | tell |
| [10] | Alternative<F> | Empty, Choose, the alternative operator |
Map, Bind, Fold, FoldBack, Exists, ForAll, At, Catch, tuple Apply, and LINQ query syntax are constraint extensionsF.Pure, F.Apply, F.Fail, F.Empty, F.Choose, T.Traverse, and T.TraverseM are calls on the witnessReadable.ask, Stateful.get, and Writable.tell are module functions that take the witness as a type argumentFallible<F> fixes E to ErrorAlternative<F> extends Choice<F> and makes Choose the generic form of |Reader<Env>, ReaderT<Env, M>, and Eff<RT> implement Readable, State<S> and StateT<S, M> implement StatefulWriter<W> and WriterT<W, M> implement WritableTransformers stack one concern over an inner monad M, and the wrapped representation decides what each Run returns:
| [INDEX] | [TRANSFORMER] | [HOLDS] | [RUN] |
|---|---|---|---|
| [01] | OptionT<M, A> | K<M, Option<A>> | Returns the wrapped value |
| [02] | FinT<M, A> | K<M, Fin<A>> as runFin | Returns the wrapped value |
| [03] | EitherT<L, M, A> | K<M, Either<L, A>> | Returns the wrapped value |
| [04] | ValidationT<Error, M, A> | Accumulates inside an effect | Returns the wrapped value |
| [05] | ReaderT<Env, M, A> | Func<Env, K<M, A>> | Applies the function to Env |
| [06] | StateT<S, M, A> | Func<S, K<M, (A, S)>> | Applies the function to S |
| [07] | WriterT<W, M, A> | W beside the value | Returns the value with W |
| [08] | RWST<R, W, S, M, A> | ask, tell, get, put | Combines the inner runs |
lift adds a layer to an evaluated value (Fin<A>, Either<L, A>, Validation<Error, A>, or the inner K<M, A>)liftIO passes an IO<A> through every layer to the IO at the bottomRun removes one layer, the host runs the layers from the outside inValidationT serves errors that must accumulate inside an effect alonerecord Wrapper<A>(StateT<S, IO, A> Inner) : K<Wrapper, A> gains the stack's capabilities through DerivingDeriving.Monad<Wrapper, StateT<S, IO>> and Deriving.Stateful<Wrapper, StateT<S, IO>, S> need Transform and CoTransform aloneDeriving.MonadIO needs a stack that implements MonadIO, StateT implements Maybe.MonadIO and Maybe.MonadUnliftIOCoTransform over StateT.liftIOCollection types, their purpose, and their construction:
| [INDEX] | [TYPE] | [PURPOSE] | [CONSTRUCTION] |
|---|---|---|---|
| [01] | Seq<A> | Ordered, memoized | Seq(1, 2, 3), toSeq(source) |
| [02] | Arr<A> | Indexed reads | Array(10, 20, 30) |
| [03] | Lst<A> | Insert, RemoveAt, SetItem | List(1, 2, 3) |
| [04] | Map<K, V> | Keyed, ordered by key | Map(("b", 2), ("a", 1)) |
| [05] | HashMap<K, V> | Keyed, hashed | HashMap(("a", 1)), toHashMap(pairs) |
| [06] | Set<A> | Unique, ordered | Set(3, 1, 2), toSet(items) |
| [07] | HashSet<A> | Unique, hashed | HashSet(3, 1, 2) |
| [08] | Iterable<A> | Lazy over IEnumerable | source.AsIterable() |
| [09] | IterableNE<A> | Non-empty, Head is a value | IterableNE.create(1, 2, 3), AsIterableNE() |
toSeq copies arrays, lists, and collections eagerly, preserves an existing Seq, and memoizes other enumerables as consumedSeq values store an array slice, lazy values combine an array prefix with a memoized sourceCons and Add reuse unclaimed capacity, branching from one version or exhausting capacity copies the backing arrayAdd forces a lazy source, Count consumes its remainder, Map and Filter defer evaluationAsSpan views strict storage or materializes lazy input; retain Strict() for reuse, and use ToArray() to flatten concatenationsLst<A> uses a balanced indexed tree, indexed reads and edits take O(log n) and edits share unchanged subtreesIterable<A> does not memoize and reruns its source on each enumerationAsIterableNE returns Option<IterableNE<A>>, None for an empty sourceRange(from, count) takes a count, Range(1, 3) yields 1, 2, 3Range<A> implements Foldable, folds, searches, counts, and aggregates read it without toSeqLanguageExt.HashSet<A>.TryAdd(value) keeps an existing member unchanged, while Add(value) rejects a duplicateFold folds left to right with a seed and FoldBack right to left:
FoldWhile and FoldUntil read the state and the next element before each step, both predicates receive a (State, Value) tupleFoldWhile stops when its predicate returns false, FoldUntil when it returns trueFoldM binds each step through a monad and folds left to right, FoldBackM folds right to left, both return K<M, S> that .As() convertsExists stops at the first match, ForAll at the first failureinternal static class Folds {
public static int WhileUnder(Seq<int> values, int limit) => values.FoldWhile(0, static (sum, x) => sum + x, pair => pair.State < limit);
public static Option<string> Joined(Seq<int> values) =>
values.FoldM("", static (text, x) => Some(string.Create(CultureInfo.InvariantCulture, $"{text}{x}"))).As();
}
Choose maps each element to an Option<B> and keeps the Some values in one pass, Somes does the same for a Seq<Option<A>>Partition splits by a predicate into a deconstructable tupleZip pairs sequences into tuples named First and Second, its projection overload takes a functionScan emits the seed first, the result has one more element than the sourceAt(index), Head, and Last are Option<A>, Tail is empty for an empty sourceMap passes the item first and the index second, Rev reversesLanguageExt.List.unfold runs a state seed until the step returns None, the static import binds the simple name List to Prelude.ListCons is written head.Cons(tail)Forms the compiler rejects:
Zip result with a Seq of unnamed tuples is ambiguous (CS9342), the expected value declares First and SecondContains, Sum, Average, and argument-free Max and Min on a Seq are ambiguous with the LINQ extensions (CS0121), membership is Exists, a sum is Fold, and an extreme is Max(seed) or Max<Seq, A>() returning Option<A>Scan over an IEnumerable<A> or Lst<A> is ambiguous with SuperEnumerable.Scan under using SuperLinq (CS0121), a Seq<A> receiver resolvesSeq<A>.Empty in expression context fails (CS0119), the simple name Seq binds to the Prelude function, the empty value is Seq<A>()Seq<A> has no Sort instance, sorting is LINQ Order() followed by toSeqSeqExtensions.Choose<A, B> takes both type arguments and Seq<A> has no instance form, Choose<int>(Parse) is CS1061Choose takes the indexed Func<int, A, Option<B>> with the index firstChoose(x => x > 0 ? x : None) is CS1660 with no target type for the conditional, Map<Option<int>> over the same lambda then Somes() compilesLens<A, B>.New takes a getter and a curried setter for a focus no record property states, LanguageExt.Core generates no lens, and each one is a static member beside its record:
Get reads the focus, Set writes a value and Update applies a function to it, both return a new Alens(outer, inner) composes lenses into one that focuses on the inner focus of the outer oneLens.identity<A>() focuses on the whole value, and a record property path is with at the editinternal sealed record Extent(double Start, double End) {
public static readonly Lens<Extent, double> Width = Lens<Extent, double>.New(static span => span.End - span.Start, static width => span => span with { End = span.Start + width });
}
internal static class Lenses {
private static readonly Lens<double, double> Half = Lens<double, double>.New(static whole => whole / 2, static half => _ => half * 2);
public static readonly Lens<Extent, double> HalfWidth = lens(Extent.Width, Half);
public static Extent Widened(Extent span, double width) => Extent.Width.Set(width, span);
public static Extent Grown(Extent span, double margin) => HalfWidth.Update(half => half + margin, span);
}
Atom<A> manages one value with compare-and-swap:
Atom, AtomHashMap, and Ref order their own writes, and a lock guards a plain fieldSwap returns the new value and reruns its function on conflict, SwapMaybe keeps the state on None and returns the current valueValue read before a separate Swap races each writeatomic over a Ref, Value then Swap reads separate statesAtomHashMap<K, V> updates in place, TryAdd ignores a present keySwapKey(key, Func<V, V>) updates a present key, SwapKey(key, Func<Option<V>, Option<V>>) inserts, updates, and removesFind reads, FindOrAdd adds a missing value or returns the existing one in one atomic stepFindOrAdd factories run on a miss and can rerun after CAS conflicts, resource acquisition needs serialized ownershipRef<A> updates run inside atomic(Func<R>), and atomic returns the function result from the transactionRef<A> and CommunityToolkit.HighPerformance Ref<T> are ambiguous in a file importing both namespaces (CS0104)swap reads the transactional valuecommute applies its function inside the transaction and again at the commit point against the last committed valueIsolation.Serialisable sets serializable isolationTrackingHashMap<K, V> records each key change in Changes, Snapshot() clears the log and keeps the entriesmemo(Func<A, B>) and memoUnsafe(Func<A, B>) cache one result per argument and compute it under a lock per keymemo holds each result behind a weak reference, a garbage collection clears it and the next call reruns the functionmemoUnsafe holds each result in a ConcurrentDictionary for the life of the returned function, a table built once and kept takes itmemo(Func<A>) returns a Memo<A> that runs the thunk once on the first Value read while concurrent readers spinMemo<A> unloaded for the next read, Reset clears the valuememoK caches the construction of a K<F, A> and not its execution, Value returns the one K<F, A>IO values run their effect on every runinternal static class SharedState {
public static int Capped(Atom<int> counter, int limit) => counter.SwapMaybe(n => n < limit ? Some(n + 1) : Option<int>.None);
public static Unit BumpOrStart(AtomHashMap<string, int> registry, string key) => registry.SwapKey(key, static n => n.Map(static v => v + 1) | Some(1));
public static Option<A> Take<A>(Ref<Option<A>> held) =>
atomic(() => {
Option<A> previous = held.Value;
held.Value = None;
return previous;
});
public static decimal Move(Ref<decimal> source, Ref<decimal> target, decimal amount) =>
atomic(() => {
_ = swap(source, balance => balance - amount);
return commute(target, balance => balance + amount);
}, Isolation.Serialisable);
}
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub bsamiee/rasm --plugin dotnet8 skills in this plugin
/codelensUse when reading, diagnosing, or refactoring a file in a .NET solution, covering the roslyn-codelens MCP server/codingUse when writing or reviewing C#, covering functional design with result and effect types/debuggingUse when C# or another CoreCLR program misbehaves at runtime and its cause is unproven (wrong value, failing test, exception, hang, crash, breakpoint that never stops), covering DNCDbg launches and attaches, held starts, test runners, PDB documents, exception stops, expressions, live process reads, and dumpsOther plugins' skills for the same job