Is it possible to cast generic types to Data? #547
-
Getting the errors
and
I guess this is impossible? |
Beta Was this translation helpful? Give feedback.
Answered by
KtorZ
May 26, 2023
Replies: 1 comment
-
It is indeed not possible to cast a non-specialised generic type (e.g. fn t_to_data(t: T<Int>) -> Datum {
InlineDatum(t.a)
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
rvcas
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It is indeed not possible to cast a non-specialised generic type (e.g.
T<a>
) toData
. You can only cast types that have a concrete representation. In your example, however,T<Int>
is very much concrete, so this would work: