Closed NCrashed closed 8 years ago
download the patch: tuple5.zip If you patch the 0.4 release it should work:
diff --git a/lc/Builtins.lc b/lc/Builtins.lc
index 271b636..d71c4d4 100644
--- a/lc/Builtins.lc
+++ b/lc/Builtins.lc
@@ -396,6 +396,8 @@ type family InterpolatedType a where
InterpolatedType (Interpolated a) = a
InterpolatedType (Interpolated a, Interpolated b) = (a, b)
InterpolatedType (Interpolated a, Interpolated b, Interpolated c) = (a, b, c)
+ InterpolatedType (Interpolated a, Interpolated b, Interpolated c, Interpolated d) = (a, b, c, d)
+ InterpolatedType (Interpolated a, Interpolated b, Interpolated c, Interpolated d, Interpolated e) = (a, b, c, d, e)
rasterizePrimitive
:: ( b ~ InterpolatedType interpolation
diff --git a/src/LambdaCube/Compiler/Infer.hs b/src/LambdaCube/Compiler/Infer.hs
index 70fab42..8c52423 100644
--- a/src/LambdaCube/Compiler/Infer.hs
+++ b/src/LambdaCube/Compiler/Infer.hs
@@ -577,7 +577,12 @@ cstrT_ typ = cstr__ []
cstr_ ns@[] (UL (FunN "'FragOps" [a])) (TyConN "'FragmentOperation" [x]) = cstr__ ns a x
cstr_ ns@[] (UL (FunN "'FragOps" [a])) (TyConN "'Tuple2" [TyConN "'FragmentOperation" [x], TyConN "'FragmentOperation" [y]]) = cstr__ ns a $ TTuple2 x y
- cstr_ ns@[] (TyConN "'Tuple2" [x, y]) (UL (FunN "'JoinTupleType" [x', y'])) = t2 (cstr__ ns x x') (cstr__ ns y y')
+ cstr_ ns@[] (TyConN "'Tuple2" [x, y]) (UL (FunN "'JoinTupleType" [a, b])) = t2 (cstr__ ns x a) (cstr__ ns y b)
+ cstr_ ns@[] (TyConN "'Tuple3" [x, y, z]) (UL (FunN "'JoinTupleType" [a, b])) = t2 (cstr__ ns x a) (cstr__ ns (TTuple2 y z) b)
+ cstr_ ns@[] (TyConN "'Tuple4" [x, y, z, w]) (UL (FunN "'JoinTupleType" [a, b])) = t2 (cstr__ ns x a)
+ (cstr__ ns (TTyCon "'Tuple3" (TType :~> TType :~> TType :~> TType) [y, z, w]) b)
+ cstr_ ns@[] (TyConN "'Tuple5" [x, y, z, w, p]) (UL (FunN "'JoinTupleType" [a, b])) = t2 (cstr__ ns x a)
+ (cstr__ ns (TTyCon "'Tuple4" (TType :~> TType :~> TType :~> TType :~> TType) [y, z, w, p]) b)
cstr_ ns@[] (UL (FunN "'JoinTupleType" [x', y'])) (TyConN "'Tuple2" [x, y]) = t2 (cstr__ ns x' x) (cstr__ ns y' y)
cstr_ ns@[] (UL (FunN "'JoinTupleType" [x', y'])) x@NoTup = t2 (cstr__ ns x' x) (cstr__ ns y' $ TTyCon0 "'Tuple0")
Thank you! Couldn't find the right place in Infer.hs
.
I build with stack and use latest commit from the repo, if the patch appears in master, I can just push commit hash. If not, I will fork and and the patch to the fork as workaround.
Again, thank you!
Use the patch for now. We will add this to master repo later.
For history: https://github.com/Teaspot-Studio/lambdacube-compiler/commit/2c53caeba24d9f37acb05f3a0b30361ffd25dffa
The patch is adapted for master and seems to work for me (original patch is for 0.4, but I wanted to stick with master).
Thank you, without the help I wouldn't be able to resolve the issue myself.
Thanks for the contribution! I implemented a solution which hopefully solves this forever. Tuples are now heterogeneous lists in master. There are several consequences:
((
element ))
Thank you!
Hi, it's I again. I hit limitation of current implementation of
InterpolatedType
family. Adding new clauses forInterpolatedType
andJoinTupleType
didn't help. Does adding support for tuples of higher dimensions require compiler fix?I still getting errors like this:
Scirpt (sorry for huge code):