Skip to content

Implement 22 default/additive primitives across non-Haskell hosts #609

Description

@joshsh

Background

While adding test coverage for previously-untested primitives (#417), the new tests exposed a
pre-existing gap: 22 primitives are defined in the kernel and implemented for the Haskell host,
but have no native implementation on the other 7 hosts (Java, Python, Scala, Clojure, Common Lisp,
Emacs Lisp, Scheme). On origin/main these were untested and unimplemented, so the suite was green; the
#417 tests surfaced the gap. The tests were removed from #417 (to keep it green) and belong here alongside
the implementations.

Primitives to implement

defineWithDefault (12) — these carry a canonical Hydra-term default implementation in the kernel, so
they are likely fixable via a single systemic default-impl-registration wiring per host rather than 12
hand-written impls:

eithers.{apply, compose, pure}, equality.notEqual, functions.{compose, const, flip},
lists.takeWhile, optionals.{foldList, mapList, mapSet}, sets.filter

plain define (10) — these need genuine per-host native implementations:

chars.isDigit, effects.mapSet, lists.{compose, foldList, mapList, mapOptional, mapSet},
maps.{difference, intersection, unions}

Scope

22 primitives × 7 non-Haskell hosts. Before hand-implementing, investigate whether the 12
defineWithDefault primitives share one root cause — the default implementation not being registered into
the non-Haskell host interpreters (cf. #388) — which could resolve all 12 at once per host. Re-add the
corresponding hydra-kernel test cases as each primitive lands.

Acceptance

/test all green with the 22 primitives' test cases restored.

Origin

Surfaced by #417 (Tentatively finalize existing primitives). Pre-existing; not a #417 regression. Split out
so #417's rename/move/removal wave can land and unblock #416.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions