This is the best way of papering over the cracks in Haxe's constructor story and import system.

write a static function called cook, it returns an object with the type name as a field, and a tuple of constructors as values.

somewhere else call cook().cons(cook()).cons(cook), and that's a fully typed entry point for the constructors you want exposed.

https://codeberg.org/ohmrun/cook

#Haxe #DevLog

ay, golden.

#Haxe #DevLog

perfect.

#DevLog #Haxe

This is so cool.

It's possible to do open ended Tuples in Haxe by using Church encoding.

I'm using this to index constructors but it would go for anything.

It uses a Church like encoding to keep a record of the type of all previous values.

It acts almost exactly like a linked list, each previous value is of a known, and independent type, just call `get()` for the value or `previous()` as many times as you need.

#Haxe #DevLog

I've had a bloody good week, and done a cool thing, but I couldn't honestly tell you what it's called.

I've got a way of encapsulating the type of constructors using only two continuation monads and a null check for each constructor.

Done and tested.

It's a partial function for constructors where it's unnecessary to specify explicitly the constructor arguments for any given type, and yet the input remains strongly typed, and indefinitely expandable.

It's fkn awesome.

#Haxe #DevLog

Now I've got a hang of composing structural types, all sorts of interesting stuff is falling out of it.

This is an open ended way to construct handlers for inputs.

using optional fields means that any value can pass through, and the handler can simply null check on it's chosen field, and by doing so increases information of the type.

#Haxe #DevLog

🍬🔢 Ah, the cutting-edge science of playing with gummy bears on a canvas! 🖍️ Dive into this groundbreaking 'simulation' where you can *gasp* move a character and push objects. 🤯 Thank heavens for the riveting #multiplayer #physics of candy land, brought to you by a melting pot of #Haxe, JS, and TypeScript! 🍭🤖
https://newkrok.github.io/nape-js/examples.html?open=soft-body&mode=3d&outline=0 #gummybears #simulation #TypeScript #HackerNews #ngated
nape-js — Interactive Physics Examples

30 interactive demos — rigid bodies, constraints, ragdolls, vehicles, cloth, and more in 2D and 3D.

I remember reading that arrows are really well suited to optimisation.

A `then` macro can inspect internal types to produce the most efficient implementing class without losing any functionality in macro time processing.

#DevLog #Haxe

The Task implementation I have is basically the I/O Monad with an Error type, except it doesn't assume that there's infinite recursion depth in whatever interpreter is running the code.
Something like a lazy stream, perhaps.

It should allow me to write a trampoline based interpreter, which makes the most of single threaded situations with minimal overhead, as well as handle asynchronous effects.

#Haxe #DevLog

There's an aphorism from way back that monads are promiscuous and arrows are meticulous.

If you can have the inputs' structural type figured out by the compiler, like you can in Haxe, arrows are a lot less meticulous because *most* what you're doing then is an I/O monad with the output of the arrow and the meticulous only when you need the extra power you get with ArrowApply.

#DevLog #Haxe