Skip to content

Standard Library

Chris Michael edited this page Jun 5, 2026 · 49 revisions

Meris

Standard Library

Console.PrintLine("ready")
String.Length("Meris")
Json.Compact("{\"ok\": true}")
Assert.True(1 == 1)
Debug.Shape(UserValue)
Db.Statement("select 1", List.Empty<Db.Value>())

Status: Catalog check yes. Interpreter yes. JVM yes where a row says Interpreter and JVM.

The standard library catalog is compiler-owned metadata. The type checker uses the catalog for module names, function signatures, builtin types, and raised standard errors. Runtime adapters provide the effectful behavior behind those names.

Evidence: StandardLibrary.kt, StandardLibraryTest, StandardRuntimeLibraryTest, jvm backend.

Builtin Types

Type Shape Status
String UTF-16 JVM string-shaped text value Interpreter and JVM
Int integer value Interpreter and JVM
Bool boolean value Interpreter and JVM
Unit no meaningful value Interpreter and JVM
Nothing no produced value Check metadata
Option<Value> Some(Value) or None carrier with structural equality when Value supports equality Interpreter and JVM
List<Element> immutable runtime list carrier with element-wise structural equality when Element supports equality Interpreter and JVM
Set<Element> immutable unique-membership carrier with structural equality when Element supports equality Interpreter and JVM
Map<Key, Value> immutable key-value carrier with structural equality for keys and values when both support equality Interpreter and JVM
Db.Connection, Db.Transaction, Db.Statement, Db.Value, Db.Row, Db.Result database boundary catalog types Catalog and type-checking
DbError builtin standard error type with database payload variants Catalog and type-checking
IoError builtin standard error type with catalog payload variants Interpreter and JVM
EnvError builtin standard error type with catalog payload variants Interpreter and JVM
JsonError builtin standard error type with catalog payload variants Interpreter and JVM
HttpError builtin standard error type with catalog payload variants Interpreter and JVM
Assert.Failure builtin standard error type for assertion helper failures Interpreter and JVM
Test.CallError builtin standard error type for in-process Server application test calls Catalog metadata; Test.CallOnce and Server.TestCall JVM target rejected
Server.Request, Server.Response, Server.TestResult server request/response/test-result metadata names with runtime carriers Check metadata, interpreter/JVM request builders/accessors, interpreter/JVM response constructors, and interpreter test-result accessors
Server.Method, Server.Path, Server.Status, Server.QueryParam, Server.Header, Server.ContentType, Server.ContentTypeParam, Server.Body server value metadata names with runtime carriers Check metadata, interpreter/JVM request builders/accessors, and response constructors
Server.StaticAsset, Server.StaticAssets source-visible static asset metadata for server applications Check metadata and test-host bridge
Server.RequestError Invalid(Message: String) request construction error Interpreter
Server.ResponseError Invalid(Message: String) construction error Interpreter

Option and List require one type argument. Standard error types can appear in raises signatures and can be caught with _ handlers. Their compiler-owned variant catalogs also support named handle arms with payload bindings. The same catalog metadata feeds LSP hover for successful standard variant constructors, so positions such as Option.Some, Option.None, and standard error variants can show compiler-owned documentation instead of guessed text.

The Server.* names are compiler catalog metadata and runtime value carriers. The interpreter and JVM backend expose validated request builders/accessors and response constructors. The interpreter also exposes Server.TestCall and Server.TestResult accessors for source-level in-process server tests. Checked route graphs and the internal JVM host are implemented for the current meris serve slice. The JVM backend emits generated application descriptors for checked applications. Public source builder values bridge into the checked application runtime/test-host path, including static asset descriptors bound to explicit test-host roots. Packaged descriptor startup exists for compiled application metadata and referenced packaged static routes in project directory output.

Evidence: StandardLibrary.kt, OpaqueStandardErrorTypeCheckerTest, option stdlib design, list stdlib design, server package design.

Standard Traits

Trait Shape Status
Counted Count(Self) -> Int, IsEmpty(Self) -> Bool, IsNotEmpty(Self) -> Bool Static dispatch for List<T>, Set<T>, and Map<K, V> in the checker, interpreter, JVM, and browser target

Counted is a compiler-owned standard trait for scalar collection facts. Use it through static generic constraints:

fun Size<T>(Items: T): Int where T: Counted {
  Items.Count()
}

Counted does not make Collection, Iterable, Iterator, Sequence, or View available. It does not approve collection literals, for loops, membership syntax, trailing lambdas, mutable collections, builders, sorting, or lazy views. dyn Counted is rejected; dynamic standard trait dispatch is not implemented.

User-authored impl Counted for List<T>, impl Counted for Set<T>, and impl Counted for Map<K, V> declarations overlap builtin standard conformances and are rejected.

Evidence: StandardCountedTypeCheckerTest, StandardCountedInterpreterTest, JvmStandardCountedBytecodeEmitterTest, BrowserCollectionProtocolReadinessTest, CollectionReceiverSyntaxParserTest, CollectionReceiverSyntaxFormatterTest.

Args

Function Signature Raises Status
Args.Count () -> Int none Interpreter and JVM
Args.Get (Index: Int) -> Option<String> none Interpreter and JVM

Args reads command-line arguments from the runtime adapter.

Evidence: MerisRuntimeTest, MerisCliRuntimeWrapperTest.

Console

Function Signature Raises Status
Console.Print (Value: String) -> Unit none Interpreter and JVM
Console.PrintLine (Value: String) -> Unit none Interpreter and JVM

Console writes through the runtime console adapter.

Evidence: core syntax fixture, InterpreterConsoleTest, JvmConsoleBytecodeEmitterTest.

Clock

Function Signature Raises Status
Clock.UnixSeconds () -> Int none Interpreter and JVM

Clock.UnixSeconds() reads the current Unix wall-clock second through the runtime clock adapter. Tests and embedders can replace that adapter, so code that observes time does not need process-global time.

This module is intentionally small. It does not define timers, sleeping, scheduling, async work, monotonic durations, time zones, or calendar formatting.

Evidence: StandardRuntimeLibraryTest, InterpreterClockTest, JvmRuntimeContextBytecodeEmitterTest, runtime adapter injection.

Env

Function Signature Raises Status
Env.Get (Name: String) -> Option<String> EnvError Interpreter and JVM
Env.Require (Name: String) -> String EnvError Interpreter and JVM

Env.Get returns Option.None when a variable is absent. Env.Require returns the value or raises EnvError.

Evidence: StandardRuntimeLibraryTest, JvmStandardErrorPayloadBytecodeEmitterTest.

String

Function Signature Raises Status
String.Length (Text: String) -> Int none Interpreter and JVM
String.Contains (Text: String, Needle: String) -> Bool none Interpreter and JVM
String.Trim (Text: String) -> String none Interpreter and JVM

Length and Contains follow the current JVM string representation. They are not grapheme-cluster APIs.

Evidence: InterpreterStringTest, JvmStringBytecodeEmitterTest, string stdlib design.

Option

Function Signature Raises Status
Option.IsSome <Value>(Value: Option<Value>) -> Bool none Interpreter and JVM
Option.IsNone <Value>(Value: Option<Value>) -> Bool none Interpreter and JVM

Option.IsSome and Option.IsNone are predicate helpers. They do not extract the wrapped value. Use match when code needs to bind the contained value. Option<T> can be matched as Some(Value) / None in the interpreter and JVM backend; qualified Option.Some(Value) and Option.None are also accepted.

Evidence: InterpreterOptionTest, JvmOptionBytecodeEmitterTest, stdlib option fixture, option stdlib design, issue 1082.

List

Function Signature Raises Status
List.Empty <Element>() -> List<Element> none Interpreter and JVM
List.Of1 <Element>(Value: Element) -> List<Element> none Interpreter and JVM
List.Of2 <Element>(First: Element, Second: Element) -> List<Element> none Interpreter and JVM
List.Count <Element>(Items: List<Element>) -> Int none Interpreter and JVM
List.Get <Element>(Items: List<Element>, Index: Int) -> Option<Element> none Interpreter and JVM
List.Append <Element>(Items: List<Element>, Value: Element) -> List<Element> none Interpreter and JVM
List.Concat <Element>(Left: List<Element>, Right: List<Element>) -> List<Element> none Interpreter and JVM
List.Reverse <Element>(Items: List<Element>) -> List<Element> none Interpreter and JVM
List.Map <Element, Target>(Items: List<Element>, Transform: fun(Value: Element): Target) -> List<Target> callback raises Interpreter and JVM
List.FlatMap <Element, Target>(Items: List<Element>, Transform: fun(Value: Element): List<Target>) -> List<Target> callback raises Interpreter and JVM
List.Filter <Element>(Items: List<Element>, Predicate: fun(Value: Element): Bool) -> List<Element> callback raises Interpreter and JVM
List.Fold <Element, Accumulator>(Items: List<Element>, Initial: Accumulator, Combine: fun(Accumulator: Accumulator, Value: Element): Accumulator) -> Accumulator callback raises Interpreter and JVM
List.Any <Element>(Items: List<Element>, Predicate: fun(Value: Element): Bool) -> Bool callback raises Interpreter and JVM
List.All <Element>(Items: List<Element>, Predicate: fun(Value: Element): Bool) -> Bool callback raises Interpreter and JVM

List is an immutable runtime carrier. List.Get is the safe access operation: it returns Option.Some(Value) when the index is present and Option.None when the index is negative or outside the list.

List.Map, List.FlatMap, List.Filter, List.Fold, List.Any, and List.All accept function values. They work with named references, non-capturing lambdas, captured lambdas, and callbacks that raise typed errors. If a callback raises, the List call raises the same typed error, stops at that element, and does not return a partial result.

List.Empty() has no element value from which to infer Element, so callers usually provide expected type context:

value Names: List<String> = List.Empty()
value Scores = List.Of2(10, 20)
List.Get(Scores, 1)
List.Map(Scores, fun(Value: Int): Int { Value + 1 })
List.Fold(Scores, 0, fun(Total: Int, Value: Int): Int { Total + Value })
type LoadError = | Missing(Index: Int)

fun CheckedScores(): List<Int> raises LoadError {
  val Scores = List.Of2(10, 20)
  List.Map(Scores, fun(Value: Int): Int raises LoadError {
    raise LoadError.Missing(Value)
  })
}

Evidence: InterpreterListTest, JvmListBytecodeEmitterTest, stdlib list fixture, list stdlib design.

Assert

Function Signature Raises Status
Assert.True (Value: Bool) -> Unit Assert.Failure Interpreter and JVM
Assert.False (Value: Bool) -> Unit Assert.Failure Interpreter and JVM
Assert.Equals <Value>(Expected: Value, Actual: Value) -> Unit Assert.Failure Interpreter and JVM
Assert.Fail (Message: String) -> Unit Assert.Failure Interpreter and JVM

Assert is the standard test assertion module. Passing assertions return Unit. Failing assertions raise Assert.Failure, so tests that intentionally let an assertion escape must declare raises Assert.Failure.

test "checks count" raises Assert.Failure {
  val Scores = List.Of2(10, 20)
  Assert.Equals(2, List.Count(Scores))
  Assert.True(List.Count(Scores) == 2)
  Assert.False(List.Count(Scores) == 0)
}

Assert.Equals uses structural equality in the interpreter and JVM object equality in compiled code. On failure it records deterministic text for Expected and Actual and includes a Message field such as expected 1 but was 2. Assert.Fail(Message) always raises the Fail variant and uses the caller-supplied message.

Assert.Failure has these catalog variants:

Variant Payload Meaning
True Message: String Assert.True received false.
False Message: String Assert.False received true.
Equals Expected: String, Actual: String, Message: String Assert.Equals received unequal values.
Fail Message: String Assert.Fail was called explicitly.

Assert.True, Assert.False, and Assert.Equals do not accept custom messages in the current API. Broader assertion design is deferred.

Evidence: StandardAssertLibraryTest, StandardRuntimeAssertLibraryTest, JvmStandardAssertCallEmitter, MerisCliTestCommandTest, tests.

Debug

Function Signature Raises Status
Debug.Shape <Value>(Value: Value) -> String none Interpreter and JVM for eligible values
Debug.Fields <Value>(Value: Value) -> String none Interpreter and JVM for eligible values

Debug.Shape renders checked Meris-owned structure without primitive leaf values. Debug.Fields renders deterministic field paths and display-eligible leaf values. Both helpers are diagnostics tools; their text is not a stable serialization format.

Eligible values are primitives, Unit, Option<T>, List<T>, Meris-owned products, closed variants, and concrete generic substitutions when nested values are also eligible. Function values, dynamic dispatch receiver internals, Java handles, resources, and unsafe host values are rejected during checking.

Evidence: DebugMetadataInterpreterTest, JvmDebugBytecodeEmitterTest, DebugMetadataTypeCheckerTest, Debug Shape And Field Metadata.

Db

Function Signature Raises Status
Db.Text (Value: String) -> Db.Value none Catalog/type-checking
Db.Int (Value: Int) -> Db.Value none Catalog/type-checking
Db.Bool (Value: Bool) -> Db.Value none Catalog/type-checking
Db.Null () -> Db.Value none Catalog/type-checking
Db.Statement (Sql: String, Values: List<Db.Value>) -> Db.Statement none Catalog/type-checking
Db.QueryOne <Target>(Connection: Db.Connection, Statement: Db.Statement, Decode: fun(Row: Db.Row): Target raises DbError) -> Option<Target> DbError Catalog/type-checking
Db.QueryAll <Target>(Connection: Db.Connection, Statement: Db.Statement, Decode: fun(Row: Db.Row): Target raises DbError) -> List<Target> DbError Catalog/type-checking
Db.Execute (Connection: Db.Connection, Statement: Db.Statement) -> Db.Result DbError Catalog/type-checking
Db.RowsAffected (Result: Db.Result) -> Int none Catalog/type-checking
Db.Begin (Connection: Db.Connection) -> Db.Transaction DbError Catalog/type-checking
Db.Commit (Transaction: Db.Transaction) -> Unit DbError Catalog/type-checking
Db.Rollback (Transaction: Db.Transaction) -> Unit DbError Catalog/type-checking
Db.TransactionQueryOne <Target>(Transaction: Db.Transaction, Statement: Db.Statement, Decode: fun(Row: Db.Row): Target raises DbError) -> Option<Target> DbError Catalog/type-checking
Db.TransactionQueryAll <Target>(Transaction: Db.Transaction, Statement: Db.Statement, Decode: fun(Row: Db.Row): Target raises DbError) -> List<Target> DbError Catalog/type-checking
Db.TransactionExecute (Transaction: Db.Transaction, Statement: Db.Statement) -> Db.Result DbError Catalog/type-checking
Db.ReadString (Row: Db.Row, Column: String) -> String DbError Catalog/type-checking
Db.ReadInt (Row: Db.Row, Column: String) -> Int DbError Catalog/type-checking
Db.ReadBool (Row: Db.Row, Column: String) -> Bool DbError Catalog/type-checking
Db.ReadStringOrNone (Row: Db.Row, Column: String) -> Option<String> DbError Catalog/type-checking
Db.ReadIntOrNone (Row: Db.Row, Column: String) -> Option<Int> DbError Catalog/type-checking
Db.ReadBoolOrNone (Row: Db.Row, Column: String) -> Option<Bool> DbError Catalog/type-checking

Db is the SQL-first database catalog. It defines prepared values, statements, row decoders, explicit transactions, and DbError payload metadata for the checker. Runtime adapters, JVM execution, and database fixtures are not implemented yet.

Use Db Boundary for the full contract and boundaries.

Evidence: StandardDbModule.kt, StandardDbLibraryTest, DbStdlibTypeCheckerTest.

Json

Function Signature Raises Status
Json.Validate (Text: String) -> Unit JsonError Interpreter and JVM
Json.Compact (Text: String) -> String JsonError Interpreter and JVM
Json.Pretty (Text: String) -> String JsonError Interpreter and JVM
Json.Decode <Target>(Text: String) -> Target JsonError Interpreter and JVM for String, Bool, Int, Option<T>, List<T>, product, generic product, and closed variant targets
Json.Encode <Target>(Value: Target) -> String JsonError Interpreter and JVM for String, Bool, Int, Option<T>, List<T>, product, generic product, and closed variant targets
Json.DecodeWith <Target>(CodecName: String, Text: String) -> Target JsonError Interpreter and JVM for checked product field-name codecs; CodecName must be a string literal
Json.EncodeWith <Target>(CodecName: String, Value: Target) -> String JsonError Interpreter and JVM for checked product field-name codecs; CodecName must be a string literal

Json works at the text boundary. Json.Decode<T>(Text) currently decodes primitive targets, Option<T>, List<T>, Meris value / data products, generic products, and closed Meris type variants through a tagged object envelope. It does not decode Unit, Nothing, or dynamic Json object values; unsupported targets raise JsonError.UnsupportedTarget.

Json.Encode<T>(Value) writes the same safe value families back to text. Products emit fields in declaration order. Generic product targets are encoded after their type arguments are resolved. Option.None becomes null; lists preserve order. Closed variants use the same Variant / Fields envelope as decode.

Primitive decoding does not coerce between Json kinds. Int accepts only JSON number tokens without a fraction or exponent and within the Meris Int range. Option<T> maps JSON null to Option.None; non-null values decode as T and are wrapped in Option.Some. List<T> accepts arrays only, preserves order, and fails the whole decode on the first bad element. List<Option<T>> accepts null elements because the element target is optional. Product decoding accepts Json objects, matches field names exactly, treats missing Option<T> fields as Option.None, rejects missing non-option fields, and rejects unknown or duplicate fields.

Json.DecodeWith<T>(CodecName, Text) and Json.EncodeWith<T>(CodecName, Value) use a checked custom codec declaration for product field-name policy. The codec name is a string literal so the checker and JVM backend can resolve the same codec plan before execution.

Closed variant decoding uses a Variant string tag and an optional Fields object for case payloads:

{ "Variant": "Loaded", "Fields": { "Value": "ready" } }

Fieldless cases omit Fields. Unknown case names raise JsonError.UnknownVariant; malformed envelopes or payload shapes raise JsonError.InvalidVariant or the same field-level failures used for product decoding.

JsonError handlers can match catalog variants. Invalid binds Offset: Option<Int>, Line: Option<Int>, and Column: Option<Int>.

Evidence: stdlib JSON fixture, InterpreterJsonTest, JvmJsonBytecodeEmitterTest, JvmJsonEncodeBytecodeEmitterTest, JvmJsonCodecBytecodeEmitterTest, StandardRuntimeLibraryJsonTest, json boundary.

Http

Function Signature Raises Status
Http.GetText (Url: String) -> String HttpError Interpreter and JVM
Http.PostText (Url: String, Body: String) -> String HttpError Interpreter and JVM

Http is a strict UTF-8 text client boundary. Malformed response bytes raise HttpError.BodyDecode(Url) instead of replacement text. Server hosting belongs to the Server runtime boundary, not this client module.

HttpError handlers can match catalog variants such as InvalidUrl(Url), Timeout(Url, TimeoutMillis), Status(Url, Status), and BodyDecode(Url).

Evidence: InterpreterHttpTest, JvmHttpBytecodeEmitterTest, HttpTextTest, http boundary.

Test

Function Signature Raises Status
Test.CallOnce <Environment>(Application: fun(): Server.Application<Environment>, Request: Server.Request) -> Server.Response Test.CallError Interpreter tests only; JVM target rejected

Test.CallOnce<Environment>(ref App, Request) starts a compiler-known Server.Application<Environment> in the in-process Server test host, sends one Server.Request, stops the application, and returns the Server.Response. The first argument must be a direct ref to a function that the compiler has recognized as a Server.Application entry. Lambdas and computed wrapper functions are rejected during checking even when their function type matches. Use Server.TestCall when a test needs status, body, headers, route pattern, failure class, or cleanup state rather than only the response value.

Test.CallError has these catalog variants:

Variant Payload Meaning
InvalidApplication Message: String The application argument or request argument is not usable as a Server test call input.
Startup Message: String Application startup failed before the request ran.
Boundary Class: String, Message: String The Server boundary failed, such as no matching route or an unchecked host/runtime boundary failure.
Application ErrorType: String, Variant: String, Message: String The matched application handler raised a typed Meris failure.
Cleanup Message: String Application cleanup failed after startup or request execution.

Evidence: ServerTestCallOnceTest, ServerTestCallOnce, StandardErrorPayloads, JvmTargetCompatibilityCheckerTest, tests, issue 1089.

Server

Function Signature Raises Status
Server.Pipeline <Environment, Context>(Stages: List<Server.Stage<Environment, Context>>) -> Server.Pipeline<Environment, Context> none Interpreter and test-host metadata
Server.Use <Environment, Context>(Name: String, Middleware: String) -> Server.Stage<Environment, Context> none Interpreter and test-host metadata
Server.Filter <Environment, Context>(Name: String, Middleware: String) -> Server.Stage<Environment, Context> none Interpreter and test-host metadata
Server.Next <Environment, Context>(Request: Server.Request) -> Server.Next<Environment, Context> none Interpreter and test-host execution
Server.Respond <Environment, Context>(Response: Server.Response) -> Server.Next<Environment, Context> none Interpreter and test-host execution
Server.TestCall <Environment>(Application: fun(): Server.Application<Environment>, Request: Server.Request) -> Server.TestResult Test.CallError Interpreter tests only; JVM target rejected
Server.TestStatusCode (Result: Server.TestResult) -> Int none Interpreter tests only; JVM target rejected
Server.TestBodyTextOr (Result: Server.TestResult, Default: String) -> String none Interpreter tests only; JVM target rejected
Server.TestHeaderOr (Result: Server.TestResult, Name: String, Default: String) -> String none Interpreter tests only; JVM target rejected
Server.TestFailureClassOr (Result: Server.TestResult, Default: String) -> String none Interpreter tests only; JVM target rejected
Server.TestRequestCleanupState (Result: Server.TestResult) -> String none Interpreter tests only; JVM target rejected
Server.TestApplicationCleanupState (Result: Server.TestResult) -> String none Interpreter tests only; JVM target rejected
Server.Application <Environment, Context>(Routes: Server.Routes<Environment>, Environment: Server.Environment<Environment>, Resources: Server.Resources<Environment>, Pipeline: Server.Pipeline<Environment, Context>, Codecs: Server.Codecs, Config: Server.Config) -> Server.Application<Environment> none Catalog and type-checking
Server.Environment <Environment>(Dependencies: List<Server.Dependency<Environment>>) -> Server.Environment<Environment> none Catalog and type-checking
Server.External <Environment, Value>(Name: String) -> Server.Dependency<Environment> none Catalog and type-checking
Server.Owned <Environment, Value>(Resource: Server.Resource<Environment>) -> Server.Dependency<Environment> none Catalog and type-checking
Server.Resource <Environment, Value>(Name: String, Acquire: String, Release: String) -> Server.Resource<Environment> none Catalog and type-checking
Server.ResourceAfter <Environment, Value>(Name: String, Acquire: String, Release: String, DependsOn: List<String>) -> Server.Resource<Environment> none Catalog and type-checking
Server.Resources <Environment>(Resources: List<Server.Resource<Environment>>) -> Server.Resources<Environment> none Catalog and type-checking
Server.JsonBodyCodec <Target>(Name: String, ContentType: Server.ContentType) -> Server.Codec<Target> none Catalog and type-checking
Server.JsonResponseCodec <Target>(Name: String, ContentType: Server.ContentType) -> Server.Codec<Target> none Catalog and type-checking
Server.Codecs <Target>(Codecs: List<Server.Codec<Target>>) -> Server.Codecs none Catalog and type-checking
Server.GetWithResponseCodec <Environment, Response>(Pattern: String, Handler: Server.RouteHandler, Response: Server.Codec<Response>) -> Server.Route<Environment> none Catalog, type-checking, and application bridge
Server.PostWithBodyCodec <Environment, Body>(Pattern: String, Handler: Server.RouteHandler, Body: Server.Codec<Body>) -> Server.Route<Environment> none Catalog, type-checking, and application bridge
Server.PostWithBodyAndResponseCodec <Environment, Body, Response>(Pattern: String, Handler: Server.RouteHandler, Body: Server.Codec<Body>, Response: Server.Codec<Response>) -> Server.Route<Environment> none Catalog, type-checking, and application bridge
Server.Config () -> Server.Config none Catalog and type-checking
Server.ConfigWithLaunch (Host: String, Port: Int) -> Server.Config none Catalog, type-checking, and serve launch defaults
Server.ConfigWithLaunchProfile (Host: String, Port: Int, Profile: String) -> Server.Config none Catalog, type-checking, and serve launch defaults
Server.Secret (Value: String) -> Server.Secret none Redacted runtime carrier
Server.SecretFromEnv (Name: String) -> Server.Secret EnvError Redacted runtime carrier
Server.GetRequest (Path: String) -> Server.Request Server.RequestError Interpreter and JVM
Server.GetRequestWith (Path: String, Query: List<Server.QueryParam>, Headers: List<Server.Header>) -> Server.Request Server.RequestError Interpreter and JVM
Server.PostTextRequest (Path: String, Text: String) -> Server.Request Server.RequestError Interpreter and JVM
Server.PostTextRequestWith (Path: String, Query: List<Server.QueryParam>, Headers: List<Server.Header>, ContentType: Server.ContentType, Text: String) -> Server.Request Server.RequestError Interpreter and JVM
Server.RequestMethod, Server.RequestPath, Server.RequestQuery, Server.RequestHeaders, Server.RequestBody request accessors none Interpreter and JVM
Server.BodyText, Server.BodyContentType body accessors returning Option none Interpreter and JVM
Server.Ok () -> Server.Status none Interpreter and JVM
Server.Created () -> Server.Status none Interpreter and JVM
Server.NoContent () -> Server.Status none Interpreter and JVM
Server.BadRequest () -> Server.Status none Interpreter and JVM
Server.NotFound () -> Server.Status none Interpreter and JVM
Server.MethodNotAllowed () -> Server.Status none Interpreter and JVM
Server.UnsupportedMediaType () -> Server.Status none Interpreter and JVM
Server.InternalServerError () -> Server.Status none Interpreter and JVM
Server.MovedPermanently () -> Server.Status none Interpreter and JVM
Server.Found () -> Server.Status none Interpreter and JVM
Server.SeeOther () -> Server.Status none Interpreter and JVM
Server.TemporaryRedirect () -> Server.Status none Interpreter and JVM
Server.PermanentRedirect () -> Server.Status none Interpreter and JVM
Server.StatusFromCode (Code: Int) -> Option<Server.Status> none Interpreter and JVM
Server.ContentTypeParam (Name: String, Value: String) -> Server.ContentTypeParam Server.ResponseError Interpreter and JVM
Server.ContentType (Type: String, Subtype: String, Parameters: List<Server.ContentTypeParam>) -> Server.ContentType Server.ResponseError Interpreter and JVM
Server.TextPlainUtf8 () -> Server.ContentType none Interpreter and JVM
Server.ApplicationJsonUtf8 () -> Server.ContentType none Interpreter and JVM
Server.Header (Name: String, Value: String) -> Server.Header Server.ResponseError Interpreter and JVM
Server.StatusOnly (Status: Server.Status) -> Server.Response Server.ResponseError Interpreter and JVM
Server.Text (Status: Server.Status, Text: String) -> Server.Response Server.ResponseError Interpreter and JVM
Server.TextWith (Status: Server.Status, ContentType: Server.ContentType, Text: String) -> Server.Response Server.ResponseError Interpreter and JVM
Server.JsonText (Status: Server.Status, Text: String) -> Server.Response Server.ResponseError Interpreter and JVM
Server.Redirect (Location: String) -> Server.Response Server.ResponseError Interpreter and JVM
Server.RedirectWith (Status: Server.Status, Location: String) -> Server.Response Server.ResponseError Interpreter and JVM
Server.WithHeader (Response: Server.Response, Header: Server.Header) -> Server.Response Server.ResponseError Interpreter and JVM

Server.Pipeline, Server.Use, and Server.Filter are the first public pipeline construction surface. A public middleware function receives Server.Request and the graph environment, then returns Server.Next<Environment, Context>. Server.Next(Request) continues the pipeline with the request value. Server.Respond(Response) stops the pipeline and returns the response before route matching.

Server.TestCall starts a compiler-known Server.Application, executes one request through the in-process test host, stops the application, and returns a Server.TestResult. Result accessors expose response status, body text, headers, matched route pattern, failure class, request cleanup state, and application cleanup state as Meris values. They do not expose host exchange objects.

Server.Application is the first public application builder catalog. It is a typed description, not a host object. Routes, environment dependencies, resources, middleware pipeline, codecs, and config are passed explicitly. The current implementation type-checks this source shape and bridges public builder values to checked application runtime descriptors for the test-host path. Homogeneous public codec lists bridge JSON body/response codec metadata when public route constructors attach the selected codec. Heterogeneous codec lists remain deferred.

Response constructors build response values for interpreter execution and JVM bytecode emission. Server.Text uses text/plain; charset=utf-8. Server.JsonText validates Json text and uses application/json; charset=utf-8; it does not perform typed Json decoding. Body-carrying constructors reject statuses that must not carry a body. Public response headers cannot set transport-owned names such as content-type or content-length; use body constructors for content type.

Invalid response construction raises Server.ResponseError.Invalid(Message: String). The JVM compile target emits public runtime carrier calls for response construction. An internal JVM HTTP host adapter can serve checked route graph or application descriptors. The JVM backend emits route graph descriptor methods for checked routes declarations and application descriptor methods for checked server applications. meris serve can start a checked route graph named by server.routeGraph or a packaged application descriptor named by manifest artifact metadata. Packaged descriptor startup can execute ordinary route handlers and pipeline middleware through generated callable metadata, runs request cleanup hooks and function-backed body/response codec hooks when their generated callable metadata and supported source-free descriptors are present, including metadata-backed generated product or variant hook values, and can serve static assets whose roots were packaged by meris compile --project.

Evidence: InterpreterServerResponseTest, ServerResponseConstructorsRuntimeTest, JvmServerResponseBytecodeEmitterTest, JvmTargetCompatibilityCheckerTest, ServerHttpHostTest, JvmServerRouteDescriptorBytecodeEmitterTest, JvmServerApplicationDescriptorBytecodeEmitterTest, MerisCliPackagedServerPipelineLauncherTest, ServerTestHostPublicApplicationBridgeTest, server package.

Fs

Function Signature Raises Status
Fs.Read (Path: String) -> String IoError Interpreter and JVM
Fs.Write (Path: String, Contents: String) -> Unit IoError Interpreter and JVM

Fs reads and writes text through the runtime file adapter.

Evidence: StandardRuntimeLibraryTest, jvm backend, fs boundary.

Clone this wiki locally