# Has anyone looked into Church encoding in the type system?

**URL:** https://community.haxe.org/t/has-anyone-looked-into-church-encoding-in-the-type-system/4788
**Category:** Haxe
**Created:** [March 11, 2026, 2:36pm UTC](https://community.haxe.org/t/has-anyone-looked-into-church-encoding-in-the-type-system/4788 "2026-03-11T14:36:47Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![0b1kn00b](https://community.haxe.org/user_avatar/community.haxe.org/0b1kn00b/32/1170_2.png) [@0b1kn00b](https://community.haxe.org/u/0b1kn00b)
#### Post date: [March 11, 2026, 2:36pm UTC](https://community.haxe.org/t/has-anyone-looked-into-church-encoding-in-the-type-system/4788/1 "2026-03-11T14:36:47Z")

</div>

I wondered if it could be done. The runtime value and the type system representation match up.

I knew you could use church encoding to encode integers, but here the GADTs allow the type representation to have the same depth and therefore the same value and ability to discern,

 ![typesystem counting trace](https://community.haxe.org/uploads/default/original/2X/2/20ab7570f570dfa6f0e3a498e253ea0103ad005c.png)

 ![typesystem counting](https://community.haxe.org/uploads/default/original/2X/5/553bf6b25809ad65516c6c2df4850d7fad64763c.png)

---

<div class="post-metadata">

### Author: ![fullofcaffeine](https://community.haxe.org/user_avatar/community.haxe.org/fullofcaffeine/32/28_2.png) [@fullofcaffeine](https://community.haxe.org/u/fullofcaffeine)
#### Post date: [March 12, 2026, 5:05pm UTC](https://community.haxe.org/t/has-anyone-looked-into-church-encoding-in-the-type-system/4788/2 "2026-03-12T17:05:31Z")

</div>

Intriguing, but you’re suffering from the [curse of knowledge](https://en.wikipedia.org/wiki/Curse_of_knowledge) here. Some context on **what** it is, **why** it’s interesting at all and why you’re doing that would be nice. The same applies to your other post about `Eff`.

---

<div class="post-metadata">

### Author: ![0b1kn00b](https://community.haxe.org/user_avatar/community.haxe.org/0b1kn00b/32/1170_2.png) [@0b1kn00b](https://community.haxe.org/u/0b1kn00b)
#### Post date: [March 12, 2026, 8:10pm UTC](https://community.haxe.org/t/has-anyone-looked-into-church-encoding-in-the-type-system/4788/3 "2026-03-12T20:10:28Z")

</div>

If there’s no takers, there’s no takers.  
There’s nothing stopping you asking a question, and there’s plenty written about the terms I’m using.
