fsharp-iwsam-errors
Installation
SKILL.md
Contains Shell Commands
This skill contains shell command directives (!`command`) that may execute system commands. Review carefully before installing.
F# IWSAM error trees
A leaf function declares its errors as an interface with static abstract members and returns
Result<_, 'e> when 'e :> LeafError<'e>. Composites in a result block pick up the union of
their leaves' constraints with no Result.mapError. The caller at the edge picks one concrete
type that implements every interface the tree needs. The gist that started this:
https://gist.github.com/TheAngryByrd/ceb18e5b219458084f6c156b538ba579. A runnable proof with
seven edge shapes and four compile-time break tests lives in scripts/. Read
references/FINDINGS.md for output you can compare against.
Rules
- A payload is a typed value. A
stringappears in an error only when it comes from outside the domain: the raw input that failed to parse, namedraw, or a message an external library or call returned, named for its source. - A domain value with a format rule gets a private constructor and a
parsefunction. Thatparseis itself a leaf. - One interface per source of failure. Name the parse leaf after the failure:
InvalidSku,UnparsedEmail. - A bundle interface that inherits several leaves is implementer convenience. Inference never names it. Add one only when several edge types implement the same set.
- Put
#nowarn "3535"at file top, or pass--nowarn:3535todotnet fsi. The in-file directive does not silence the main script underdotnet fsi. - A leaf that also takes a capability env as
#IProvideXmust name'envin its explicit type parameters:<'env, 'e when 'env :> IProvideX and X<'e>>. Thefsharp-env-capabilitiesskill records theFS0064failure.