# \[ANN\] Experimental Dependent Types in Haskell Fork

**URL:** <https://discourse.haskell.org/t/ann-experimental-dependent-types-in-haskell-fork/15214>\
**Category:** Announcements\
**Tags:** llm-use\
**Created:** [November 28, 2026, 3:20am UTC](https://discourse.haskell.org/t/ann-experimental-dependent-types-in-haskell-fork/15214 "2026-11-28T03:20:03Z")\
**Posts on this page:** 2\
**Page:** 3

<div class="post-metadata">

**Author:** ![Tritlo](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/tritlo/32/2974_2.png) [@Tritlo](https://discourse.haskell.org/u/Tritlo)\
**Post date:** [November 29, 2026, 9:25pm UTC](https://discourse.haskell.org/t/ann-experimental-dependent-types-in-haskell-fork/15214/41 "2026-11-29T21:25:27Z")

</div>

The ones found so far have been compiler bugs, but I have discovered some clarifications required (e.g. for exports of _function bodies_, Eisenberg’s thesis has one line about exports, nothing about imports, and it clashes with how Agda, Idris and Lean do it). I’ll write up these things once I have a better idea of the scope

Edit: there are also some interactions with instances that we’ll need to address.

So we’re getting some useful data already!

---

<div class="post-metadata">

**Author:** ![Tritlo](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/tritlo/32/2974_2.png) [@Tritlo](https://discourse.haskell.org/u/Tritlo)\
**Post date:** [November 29, 2026, 9:32pm UTC](https://discourse.haskell.org/t/ann-experimental-dependent-types-in-haskell-fork/15214/42 "2026-11-29T21:32:21Z")

</div>

Quick agent write-up to satisfy curiosity for now (some of it is talking about in-progress stuff, nothing final here. I’m changing it to more closely match the thesis, and then we can discuss this later in the process in a proposal where that discussion belongs)

* * *

**Function bodies across modules in the Dependent Haskell fork: export rules and an open question about instances**

Type-level computation needs a function’s body: to check that `pred (Succ n)` reduces to `n`, the type checker must see the definition of `pred`. So a module boundary has to answer two questions for each function: is its _type_ visible to importers, and is its _body_?

**Starting point: Eisenberg’s thesis, §4.4.6**

> If a user includes pred in an import/export list, only the name pred and its type are involved. On the other hand, writing pred(..) (with a literal (..) in the source code) in the import/export list also includes pred’s implementation.

The syntax echoes `Bool` vs `Bool(..)` for constructors. Proposal #378 does not discuss this.

**What we implement**

- In a `-XDependentTypes` module with an export list, `f` exports the name and the type of `f`, and `f (..)` also exports its body. In an importer, a call `f x` to a function whose body is not exported is stuck: it is a type equal only to itself.
- A module without an export list exports all bodies, following Haskell’s “no export list exports everything” (similar to Lean’s `@[expose] public section`).
- A module without `-XDependentTypes` exports all bodies as before (the Opt-In Principle).
- **Import lists do not hide bodies.** Here we deviate from the thesis. `import M (f (..))` is accepted and means the same as `import M (f)`. Reasons:
  - one interface file serves every importer;
  - neither Idris 2 nor Lean 4 controls bodies on the import side (Lean’s `import all` only adds);
  - with the thesis rule, `import Prelude ((.))` would stop `(.)` from reducing in types, which we found too surprising.

This matches Idris 2 (`export` = type only, `public export` = type and body) and Lean 4 (`def` bodies are private unless marked `@[expose]`). Agda goes the other way (bodies are visible unless inside `abstract` or `opaque`).

**Planned**

- **An exported body cannot use a hidden name.** If `f (..)`'s body calls a function `g` whose body is not exported, the defining module gets an error: export `g (..)`, or export `f` without `(..)`. This is the Idris 2 rule (“`public export` definitions cannot use `private` or `export` names”), and Lean 4 has the same idea (“No information from the private scope can be used in the public scope”). Today the fork instead publishes such helper bodies silently, which leaks bodies the author never exported.
- **No computation with a hidden body.** A closed call such as `f 4` of a function whose body is not exported will stay stuck in importers. Today it can still be evaluated by running the compiled code, which reveals the body.

**Open question: instances**

Haskell exports every instance, and an instance has no syntax to hide one method. So what should happen here?

```haskell
module M (Bit (..), Turn (..)) where

class Turn a where
  forward :: a -> a

turn :: Bit -> Bit -- not exported
turn Off = On
turn On = Off

instance Turn Bit where
  forward = turn

```

Should `forward Off` reduce to `On` in a module that imports `M`?

1. **Error,** following Lean 4, where an `instance` always exposes its body: the instance uses the hidden `turn`, so you must export `turn (..)`. Lean lets you mark a single instance field `private`; Haskell has no equivalent.
2. **Withhold:** the method body is not exported because it uses a hidden name, so `forward Off` is stuck in importers.

(Idris 2’s documentation does not cover the visibility of implementations.) We are measuring how much existing code each option breaks. We’d be glad to hear opinions or prior art, especially from Idris, Lean and Agda users.

References:

- [Idris 2: Modules and Namespaces](https://idris2.readthedocs.io/en/latest/tutorial/modules.html)
- [Lean 4: Module System, Visibility](https://lean-lang.org/doc/reference/4.25.0/The-Module-System/Visibility/)
- [GHC Proposal #378](https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0378-dependent-type-design.rst)

[Previous page](https://discourse.haskell.org/t/ann-experimental-dependent-types-in-haskell-fork/15214.md?page=2)
