Skip to content

hs-jev

Haskell client for Jev that batches typed Choice, Score and Noul questions into one call via a free applicative.

Librarybeta

Overview

hs-jev is a Haskell client for TypeSafe's System One decision API. Questions are built as values in an Ask free applicative and combined with applicative operators, so several Choice, Score and Noul questions go out in a single batched request and each answer comes back with its type known at the use site, without string keys or Maybe. A closed-enum helper maps a Choice directly onto a Haskell sum type and fails with UnknownChoiceKey if the API returns an unexpected key.

It is for Haskell developers who want typed decisions in their programs. The package also includes a Patterns module with three-band confidence routing and normalised composite scoring, retry handling, and an injectable structured-event logging callback. It ships with an offline hermetic test suite, an opt-in live suite, and examples recreating TypeSafe docs scenarios: support triage, a six-Noul spam check, and a role-weighted resume screen.

What the decision model decides

TypeQuestionAnswers
ChoiceWhich team?billing · returns · shipping
Yes / noEscalate to a human?yes · no
ScoreRole-weighted resume criteria (four Scores)—

How it works

  1. Build questions with askChoice, askNoul, askScore or askChoiceEnum
  2. Compose them applicatively into one Ask
  3. callJev sends a single batched request
  4. Decode typed results and route with band thresholds

Strengths

  • Type-safe answers with compile-time knowledge of each result type
  • All questions batched in one call
  • Offline hermetic tests plus an opt-in live suite

Caveats

  • Built with Nix; non-Nix users may need extra setup
  • No licence stated in the README
  • Needs a TypeSafe API key for live use

Getting started

`nix develop .#dev --command cabal build all`; run examples with `cabal run hs-jev-examples -- support-triage` after setting TYPESAFE_API_KEY.

At a glance

Type
Library
Status
beta
Language
Haskell
Runtime
library
Has code
yes
Has tests
yes

Use cases and integrations

How curated lists describe it

Frequently asked questions

What does hs-jev provide?

A typed Haskell client for Jev's Choice, Score and Noul questions, batched into one API call.

Can I map a Choice onto my own enum?

Yes, askChoiceEnum maps answers to a closed Haskell type and errors on unknown keys.

Do tests need an API key?

No for the offline spec suite; the live suite skips cleanly if the key is unset.

Related projects

  • Hack Club's lightweight LLM proxy, listed for adding a Jev forwarding endpoint behind its auth, limits and usage logging.

    MCP serverproductionTypeScript
  • Ax, a DSPy-style multi-language LLM framework, listed with a native TypeSafe provider for Boolean, Choice, Score and raw Jev questions.

    PluginproductionTypeScript
  • Effect TypeScript library whose @effect/ai-typesafe package maps classify, probability and rating operations to Jev questions.

    ProjectproductionTypeScript
  • PHP monorepo whose Polyglot module adds a TypeSafe driver for typed Noul, Choice and Score decisions alongside LLM inference.

    ProjectproductionPHP
  • Go MCP server giving any client typed Jev decisions via OpenRouter or TypeSafe, with validated answers and no paid retries.

    MCP serverproductionGo
  • Simon Willison's LLM plugin that adds Jev as a model for yes/no, choice and score questions from the command line.

    PluginproductionPython