[Haskell-cafe] Representing a type system in Haskell
Olaf Klinke
olf at aatal-apotheke.de
Tue Jul 11 15:51:58 UTC 2023
> So this type system was designed such that I could:
> Get a value of a type -> Convert it to lua types -> call lua code
> with it -> Convert into my type system -> Type check the result
I think you're describing a functor here, at least a commutative
square. You're looking at a subset of Haskell, described by the types
of your scripting language, whose functions can be mapped to another
language (lua in your case).
Personally, I would try to avoid defining, parsing and type-checking an
entirely new language if there is a chance of embedding it into
Haskell. Especially when it must be quite feature-rich as for writing
games. Perhaps a quasi-quoter is sufficient?
Also have a look at 'zoom' and 'focus' from the lens package. They let
you write state transformers that care only about a subset of your huge
game state, where the subset is described by a lens.
Olaf
More information about the Haskell-Cafe
mailing list