# More stuff on type level composition

**URL:** <https://community.haxe.org/t/more-stuff-on-type-level-composition/4791>\
**Category:** Haxe\
**Created:** [March 18, 2026, 11:07am UTC](https://community.haxe.org/t/more-stuff-on-type-level-composition/4791 "2026-03-18T11:07:25Z")\
**Posts on this page:** 1\
**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 18, 2026, 11:07am UTC](https://community.haxe.org/t/more-stuff-on-type-level-composition/4791/1 "2026-03-18T11:07:25Z")

</div>

Doing combinators with `A & B` typedefs it really satisfying as afaict it’s completely open ended.

This here allows you to compose an open ended, automatically typed partial function (like a fold), and it just requires that each switch case be structurally typed.

 ![discriminating structural types trace](https://community.haxe.org/uploads/default/original/2X/b/bc73239de3f834ef603f5da0f95af43e6f2d7605.png)  
 ![discriminating structural types](https://community.haxe.org/uploads/default/original/2X/6/6ccb93687d1cd60b20efc6534791a296f932ef61.png)  
 ![discriminating structural types trace type](https://community.haxe.org/uploads/default/original/2X/1/1d2d6825275fb7109cfb8b570b2f6328b819f127.png)
