Haskell Examples

HaskellOct 23, 2026

Haskell base64 encoder and validated decoder

Encodes strings to base64 and decodes them back, rejecting malformed lengths and characters outside the alphabet.

validationencodingbase64
000
HaskellOct 23, 2026

Haskell aligned plain-text table renderer

Renders rows as a plain-text table with per-column alignment, padding every cell to the widest value in its column.

formattingtableterminal
000
HaskellOct 23, 2026

Haskell field-level signup validation errors

Validates signup fields and returns a list of per-field messages, so callers can show each error next to its input.

errorsvalidationforms
000
HaskellOct 23, 2026

Haskell URL query string encoder and parser

Percent-encodes key-value pairs into a query string and parses query strings back, decoding percent escapes safely.

query-stringurlencoding
000
HaskellOct 23, 2026

Haskell JSON decode with field-level errors

Decodes JSON bytes and turns missing or mistyped fields into readable messages instead of opaque parser failures.

parsingerrorsjson
000
HaskellOct 23, 2026

Haskell bounded worker pool using QSem

Runs IO actions on a fixed set of threads gated by a semaphore, returning all results in input order even when some fail.

concurrencyworker-poolexceptions
000
HaskellOct 23, 2026

Haskell timeout HTTP GET and JSON decode

Fetches a URL over HTTP with a microsecond timeout and decodes the JSON body, reporting timeouts and errors as Left.

httpjsontimeout
000
HaskellOct 23, 2026

Haskell environment config loader with validation

Reads typed settings from environment variables, applying defaults and reporting every validation failure at once.

environmentconfigurationvalidation
000
HaskellOct 23, 2026

Haskell token bucket rate limiter

Implements a token bucket that tolerates bursts up to a capacity while enforcing a steady average refill rate.

concurrencyrate-limitingtokens
000
HaskellOct 23, 2026

Haskell bounded LRU cache over Data.Map

Builds a size-bounded cache that evicts the least recently used entry, using an IORef and a map of keys to timestamps.

lrucachemutable-state
000
HaskellOct 23, 2026

Haskell multi-key record sort with nulls last

Sorts records stably by several keys at once, comparing present ages before missing ones so blanks always land last.

sortingrecordscomparator
000
HaskellOct 23, 2026

Haskell streaming line reader with foldLinesM

Streams a file line by line with constant memory, applying a monadic fold so large inputs never load into RAM.

streamingfoldsfile-io
000
HaskellOct 23, 2026

Haskell split a list into fixed-size batches

Splits a list into consecutive batches of at most n elements, plus a helper that pairs every batch with its index.

batchingchunkinglists
000
HaskellOct 23, 2026

Haskell deep clone and recursive merge of values

Recursively copies a nested value tree and merges two objects, letting right-hand keys win and concatenating arrays.

mergedeep-copyrecords
000
HaskellOct 23, 2026

Haskell capped exponential retry with jitter

Runs a fallible IO action with capped exponential backoff and jitter, returning the first success or the last exception.

exceptionsbackoffretry
000