thc:runtime
Copyright(C) 2026 Edward Kmett
LicenseUPL-1.0 AND BSD-3-Clause
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityexperimental
PortabilityGHC FFI; THC runtime services or native fallback implementation
Safe HaskellTrustworthy
LanguageHaskell2010

THC.Runtime

Description

Read-only runtime identity and permissions. The trusted boundary consists only of fixed, validated selectors; no raw foreign values escape this module.

Synopsis

Documentation

data Available a Source #

An absent metric is not zero. Queries never enable JVM-wide monitoring. fmap transforms a genuine value and preserves every non-value status:

>>> fmap (+ 1) (Available (41 :: Int))
Available 42
>>> fmap (+ 1) (Disabled :: Available Int)
Disabled
>>> map (fmap (+ 1)) [Unsupported, Disabled, Denied, Unavailable :: Available Int]
[Unsupported,Disabled,Denied,Unavailable]

Constructors

Available a

A genuine value; its scope is specified by the query.

Unsupported

The runtime or provider does not implement this service.

Disabled

Supported, but its instrumentation or sink is switched off.

Denied

The current context or host security policy forbids access.

Unavailable

Normally supported, but no value is currently available.

Instances

Instances details
Functor Available # 
Instance details

Defined in THC.Runtime.Types

Methods

fmap :: (a -> b) -> Available a -> Available b #

(<$) :: a -> Available b -> Available a #

Eq a => Eq (Available a) # 
Instance details

Defined in THC.Runtime.Types

Methods

(==) :: Available a -> Available a -> Bool #

(/=) :: Available a -> Available a -> Bool #

Ord a => Ord (Available a) # 
Instance details

Defined in THC.Runtime.Types

Show a => Show (Available a) # 
Instance details

Defined in THC.Runtime.Types

data RuntimeKind Source #

Runtime supplying the service ABI, independently of its selected backend.

Constructors

NativeGHC 
TruffleHaskell 

data Backend Source #

Execution backend reported by the current runtime context.

Instances

Instances details
Eq Backend # 
Instance details

Defined in THC.Runtime

Methods

(==) :: Backend -> Backend -> Bool #

(/=) :: Backend -> Backend -> Bool #

Ord Backend # 
Instance details

Defined in THC.Runtime

Show Backend # 
Instance details

Defined in THC.Runtime

data RuntimeInfo Source #

Version strings are informational, not feature-detection interfaces.

Instances

Instances details
Eq RuntimeInfo # 
Instance details

Defined in THC.Runtime

Show RuntimeInfo # 
Instance details

Defined in THC.Runtime

data RuntimeCapabilities Source #

Permissions are for the current THC context, not the entire JVM. CPU capacity is the context's initial eligible capacity, not a thread count.

runtimeInfo :: IO RuntimeInfo Source #

Query runtime identity and informational version strings. Each field keeps its own Available status; native GHC has no JVM identity to report.

A client can inspect one field without assuming the others are available:

info <- runtimeInfo
case runtimeKind info of
  Available kind -> print kind
  status -> print status

runtimeCapabilities :: IO RuntimeCapabilities Source #

Query context permissions and initial CPU capacity without changing them. Permission to use a service is distinct from the service being available.