8 packages
CorePACKAGE
The core types, list operations, and abstractions used throughout Cinch programs.
4 modulesBSD-3-ClauseCinch contributors
↗DataPACKAGE
Persistent maps, sets, and nonempty collections.
3 modulesBSD-3-ClauseCinch contributors
↗TextPACKAGE
UTF-8 processing and composable text parsers.
2 modulesBSD-3-ClauseCinch contributors
↗DataPACKAGE
JSON values, typed decoders, and path-aware error messages.
2 modulesBSD-3-ClauseCinch contributors
↗NetworkingPACKAGE
HTTP request and response types with an effect-explicit client.
2 modulesBSD-3-ClauseCinch contributors
↗ConcurrencyPACKAGE
Scoped tasks and bounded channels with explicit ownership transfer.
2 modulesBSD-3-ClauseCinch contributors
↗SystemPACKAGE
Durations, wall-clock instants, and monotonic measurements.
1 moduleBSD-3-ClauseCinch contributors
↗TestingPACKAGE
Property checks, generators, and a small test runner.
2 modulesBSD-3-ClauseCinch contributors
↗MODULEcinch-base
Primitive types and the common vocabulary shared by the standard libraries.
↗MODULEcinch-base
Values that may be absent, without sentinel values or null.
↗MODULEcinch-base
Finite, ordered collections with structural recursion and total projections.
↗MODULEcinch-base
Recoverable errors carried in the result type.
↗MODULEcinch-collections
Ordered, persistent key-value maps.
↗MODULEcinch-collections
Persistent collections of distinct values.
↗MODULEcinch-collections
Collections whose type guarantees at least one element.
↗MODULEcinch-text
Decode, encode, and inspect UTF-8 text.
↗MODULEcinch-text
Small parsers that compose into larger parsers.
↗MODULEcinch-json
A JSON value tree and its textual representation.
↗MODULEcinch-json
Convert a JSON value to a specific application type.
↗MODULEcinch-http
Shared HTTP message types.
↗MODULEcinch-http
An HTTP client whose network operations appear in its effect signature.
↗MODULEcinch-async
Tasks whose lifetime is bounded by a surrounding scope.
↗MODULEcinch-async
Bounded communication with backpressure.
↗MODULEcinch-time
Time values with distinct wall-clock and duration types.
↗MODULEcinch-test
Describe properties and generate input values.
↗MODULEcinch-test
Group tests and report their results.
↗typecinch-base
NatPrelude
data Nat
An unbounded natural number. Arithmetic on Nat does not overflow.
↗typecinch-base
↗typecinch-base
IntPrelude
opaque Int
An unbounded signed integer.
↗typecinch-base
opaque String
An immutable string of Unicode text.
↗typecinch-base
RefPrelude
opaque Ref region a
A reference that borrows a value for the lifetime of region.
↗typecinch-base
data Unit
The type with a single value, ().
↗typecinch-base
opaque Bytes
An immutable sequence of bytes.
↗typecinch-base
IoPrelude
effect Io region
An effect for interaction with an external environment.
↗classcinch-base
OrdPrelude
signature Ord a
A total ordering on values of a type.
↗functioncinch-base
idPrelude
id :: forall a. a -> a
Return the supplied value unchanged.
↗functioncinch-base
const :: forall a b. a -> b -> a
Return the first argument and ignore the second.
↗typecinch-base
data Option a
Either a present value or its absence.
↗functioncinch-base
mapData.Option
map :: forall a b. (a -> b) -> Option a -> Option b
Apply a function to a present value. None remains None.
↗functioncinch-base
with-default :: forall a. a -> Option a -> a
Extract a present value, or return the supplied default.
↗functioncinch-base
is-some :: forall a. Option a -> Bool
Report whether a value is present.
↗typecinch-base
ListData.List
data List a
A finite sequence of values of the same type.
↗functioncinch-base
mapData.List
map :: forall a b. (a -> b) -> List a -> List b
Transform each element, retaining the order of the input.
↗functioncinch-base
foldr :: forall a b. (a -> b -> b) -> b -> List a -> b
Fold a list from the right using a combining function and an initial value.
↗functioncinch-base
length :: forall a. List a -> Nat
Count the elements in a finite list.
↗functioncinch-base
headData.List
head :: forall a. List a -> Option a
Return the first element when present. An empty list produces None.
↗functioncinch-base
filter :: forall a. (a -> Bool) -> List a -> List a
Retain elements that satisfy the predicate, in their original order.
↗typecinch-base
data Result e a
A successful value or a recoverable error.
↗functioncinch-base
mapData.Result
map :: forall e a b. (a -> b) -> Result e a -> Result e b
Transform a successful result, preserving an error.
↗functioncinch-base
map-error :: forall e f a. (e -> f) -> Result e a -> Result f a
Transform the error while leaving successful values alone.
↗typecinch-collections
MapData.Map
opaque Map k v
A persistent mapping from ordered keys to values.
↗functioncinch-collections
empty :: forall k v. Map k v
Construct an empty map.
↗functioncinch-collections
insert :: forall k v. using (ord :: Ord k) => k -> v -> Map k v -> Map k v
Insert a value. An existing value at the same key is replaced.
↗functioncinch-collections
lookup :: forall k v. using (ord :: Ord k) => k -> Map k v -> Option v
Find the value associated with a key.
↗functioncinch-collections
keys :: forall k v. Map k v -> List k
Return keys in ascending order.
↗typecinch-collections
SetData.Set
opaque Set a
A collection containing each value at most once.
↗functioncinch-collections
empty :: forall a. Set a
Construct an empty set.
↗functioncinch-collections
member :: forall a. using (ord :: Ord a) => a -> Set a -> Bool
Test whether the set contains a value.
↗functioncinch-collections
union :: forall a. using (ord :: Ord a) => Set a -> Set a -> Set a
Combine two sets, retaining each value once.
↗typecinch-collections
data NonEmpty a
One head element followed by a possibly empty tail.
↗functioncinch-collections
headData.NonEmpty
head :: forall a. NonEmpty a -> a
Read the first element. No empty case is possible.
↗functioncinch-collections
to-list :: forall a. NonEmpty a -> List a
Forget the nonempty guarantee and retain the values.
↗typecinch-text
data Utf8Error
An invalid byte sequence and the offset at which decoding failed.
↗functioncinch-text
decode :: Bytes -> Result Utf8Error String
Decode UTF-8 bytes. Invalid sequences produce a structured error.
↗functioncinch-text
encode :: String -> Bytes
Encode a string as UTF-8 bytes.
↗functioncinch-text
lines :: String -> List String
Split text at line boundaries.
↗typecinch-text
opaque Parser a
A parser that either produces a value or reports a position and expectation.
↗typecinch-text
data ParseError
A source position and the expectations that were not met.
↗functioncinch-text
parseText.Parser
parse :: forall a. Parser a -> String -> Result ParseError a
Run a parser and require it to consume the full input.
↗functioncinch-text
integer :: Parser Int
Parse a signed decimal integer.
↗typecinch-json
JsonData.Json
data Json
A null, boolean, number, string, array, or object value.
↗typecinch-json
data JsonError
A byte offset and description of a malformed JSON document.
↗functioncinch-json
parse :: String -> Result JsonError Json
Parse a complete JSON document.
↗functioncinch-json
render :: Json -> String
Render a compact JSON representation.
↗typecinch-json
DecoderData.Json.Decode
opaque Decoder a
A typed decoder with a path-aware failure report.
↗typecinch-json
data DecodeError
The path, expected type, and actual value at a failed decoding step.
↗functioncinch-json
decodeData.Json.Decode
decode :: forall a. Decoder a -> Json -> Result DecodeError a
Apply a decoder to a JSON value.
↗functioncinch-json
fieldData.Json.Decode
field :: forall a. String -> Decoder a -> Decoder a
Decode a named field in an object.
↗functioncinch-json
stringData.Json.Decode
string :: Decoder String
Accept a JSON string.
↗typecinch-http
record Request
A request method, URL, headers, and optional body.
↗typecinch-http
record Response
A status code, response headers, and body bytes.
↗typecinch-http
data HttpError
A connection, protocol, or timeout failure.
↗functioncinch-http
status-code :: Response -> Nat
Read the numerical HTTP status code.
↗functioncinch-http
getNet.Http.Client
get :: String ->{Io r} Result HttpError Response
Send a GET request. Connection failures remain explicit in Result.
↗functioncinch-http
sendNet.Http.Client
send :: Request ->{Io r} Result HttpError Response
Send a request with an explicit method, headers, and body.
↗functioncinch-http
with-timeout :: Nat -> Request ->{Io r} Result HttpError Response
Send a request with a timeout expressed in milliseconds.
↗typecinch-async
TaskControl.Task
opaque Task scope a
A handle to a scoped computation. Its result can be joined once.
↗functioncinch-async
spawnControl.Task
spawn :: forall a. (Unit ->{Io r} a) ->{Io r} Task scope a
Start a child computation in the current scope.
↗functioncinch-async
joinControl.Task
join :: forall a. Task scope a ->{Io r} a
Wait for a task and consume its result handle.
↗typecinch-async
ChannelControl.Channel
opaque Channel a
A bounded channel used to transfer values between tasks.
↗functioncinch-async
sendControl.Channel
send :: forall a. Channel a -> a ->{Io r} Unit
Send a value, waiting when the channel is full.
↗functioncinch-async
receiveControl.Channel
receive :: forall a. Channel a ->{Io r} Option a
Receive the next value. A closed channel produces None.
↗typecinch-time
opaque Duration
A nonnegative span of time.
↗typecinch-time
opaque Instant
A point on the monotonic clock.
↗functioncinch-time
milliseconds :: Nat -> Duration
Construct a duration from milliseconds.
↗functioncinch-time
nowData.Time
now :: Unit ->{Io r} Instant
Read the monotonic clock.
↗functioncinch-time
elapsed :: Instant -> Instant -> Duration
Measure the duration between two instants.
↗typecinch-test
GenTest.Check
opaque Gen a
A deterministic generator that produces values from a seed.
↗typecinch-test
opaque Property
A testable proposition with a failure report and counterexample.
↗functioncinch-test
for-all :: forall a. Gen a -> (a -> Bool) -> Property
Test a property over generated values.
↗functioncinch-test
check :: Nat -> Property ->{Io r} Result String Unit
Run a property for the requested number of examples.
↗typecinch-test
TestTest.Runner
opaque Test
A named test or group of tests.
↗functioncinch-test
groupTest.Runner
group :: String -> List Test -> Test
Name a collection of tests.
↗functioncinch-test
runTest.Runner
run :: List Test ->{Io r} Nat
Run a test collection and return the number of failures.
↗No matching entries.
Try a shorter name, a type such as Option, or another category.