Open lboklin opened 5 years ago
Let me see if I understand... Every method would be a function which would have a type similar to the following one?
foo :: Monad m => b -> c -> a -> m a
@rainbyte They already do since we usually need to do IO in them; the only changes this makes to type signatures is that we
Mob
and RigidBody2D
are passed separately) - I don't know if this is the best way to do it or if they should be joined with a data Godot a = Godot Object a
higher order type so we receive a Godot Mob
, though we're running out of good type names at this point :p MVar
s or TVar
s becauses that happens before and after we see themIs there any update for this? plus what about Godot monad abstracting over Monad.IO.Class
?
The currently pending PR (#23) requires the user to make use of Template Haskell, which made me think that if we're going to introduce code generation we may as well go all the way and create a DSL that is at least ergonomic to use and closer to GDScript in syntax.
I doodled some pseudo code for what we might want it to end up looking like:
this would generate loosely something like this:
This could probably be made even tidier with a state transformer type.
The result is much closer to a functional substitute for GDScript, but whether this works in implementation remains to be seen, as I haven't spent enough time with Haskell code generation to spot any blockers but handling variable number of arguments for various top level function declarations might be difficult (or not).
It may be worth investigating available extensible records libraries as well.