Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support GADT? #83

Open
kevinresol opened this issue Jan 20, 2021 · 0 comments
Open

Support GADT? #83

kevinresol opened this issue Jan 20, 2021 · 0 comments

Comments

@kevinresol
Copy link
Member

kevinresol commented Jan 20, 2021

Currently the following snippet will fail with:
src/tink/macro/Sisyphus.hx:81: characters 22-57 : Type not found : T

class Main {
	static function main() {
		trace(stringify(VInt(TInt8, 0)));
	}
	
	static function parse<T>(v:String) {
		return tink.Json.parse((v:CValue<T>));
	}
	static function stringify<T>(v:CValue<T>):String {
		return tink.Json.stringify(v);
	}
}

enum CType<T> {
	TUInt8:CType<Int>;
	TInt8:CType<Int>;
	TBool:CType<Bool>;
	TArray<V>(type:CType<V>, size:Int):CType<Array<V>>;
}

enum CValue<T> {
	VInt(type:CType<Int>, v:Int):CValue<Int>;
	VBool(v:Bool):CValue<Bool>;
	VArray<V>(type:CType<Array<V>>, v:Array<V>):CValue<Array<V>>;
}

Changing the signature of stringify to the following will make the error more epic:
static function stringify(v:CValue<Dynamic>):String

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant