<div dir="ltr">So to make sure I'm understanding correctly, you want to create your own statically typed scripting language for your game engine?  Implementing your own statically-typed language is definitely a fun and worthwhile learning experience.  You might find helpful the notes from my programming languages course, which is taught in Haskell: <a href="https://hendrix-cs.github.io/csci360/">https://hendrix-cs.github.io/csci360/</a><div><br></div><div>Having `Type` and `Value` ADTs to represent types and values makes sense.  They often do correspond closely since there is often a canonical kind of value for each type, but they are not necessarily exactly the same.</div><div><br></div><div>You didn't mention an ADT for expressions/terms, i.e. syntax.  Typically you will parse concrete syntax to produce a Term, and then you will typecheck a Term to make sure it has a valid Type.  Then you can interpret the Term to produce a Value.</div><div><br></div><div>I am not sure what the point of TypedValue is.  Typically, once you are finished with typechecking, you no longer need to keep track of types while interpreting.</div><div><br></div><div>-Brent</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jul 10, 2023 at 7:36 AM Talha Qamar via Haskell-Cafe <<a href="mailto:haskell-cafe@haskell.org">haskell-cafe@haskell.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>Hello everyone, I'm working on a game engine in Haskell. The thing is, while I want to write the architecture in Haskell, I'm thinking of using something else as the actual scripting language.<br><br>Long story short, how would I represent a type system in Haskell? I've gotten _something_ together that works a bit like this:<br><br>```<br>data Type = -- ...all possible types<br>data Value = -- ...all possible types again<br>data TypedValue = TypedValye Type Value<br>```<br>But I'm concerned if this is the ideal way of doing things, particularly when I get to complex types like structs or tagged unions.<br><br>Any help would be appreciated.<br><br>Sent from Proton Mail mobile<br><br><br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
Only members subscribed via the mailman list are allowed to post.</blockquote></div>