I was trying to add some "derive" functionality by representing datatypes,
say "a" with some generic datatype, say "rep (a)". However, for a generic
function to work on a value of type "rep (a)", we need the type information
for the actual values stored in the original value of type "a" (which
I'd like to write something like the following code:
#include "share/atspre_staload.hats"
#include "share/atspre_define.hats"
typedef test = () -> int(* better type later *)
typedef suite(data:t0ype,n:int) = @{
name = string,
setup = (data -> void),
teardown = (data -> void),
Unfortunately, this is not currently supported in ATS.
You need to go through C in order to create a value of type suite(a, n):
%{^
typedef
struct {
void *name,
void *setup,
void *teardown,
void *tests[0]
} suite;
%}
typedef
suite(data:t0ype,n:int) =
$extype_struct "suite" of {