Hi, I have some question about function type annotation. Are we allowed to use Int * and Frac * in the type annotation? Or the compiler only accept a specific type like I32 and F32?
image.png
You can use “*” in an annotation - however two *s are always different and disjoint type variables. In this case, you want to say that Int * maps to the same Int type, so you need to use a named type variable to reflect that relationship. Changing the signature to “Int a -> Int a” would work
If on the other hand you only produce or consume a * in one location and don’t care about the relationship, you can use * freely, for example in the signatures “{} -> Int *” or “Int * -> {}”
That's an interesting point. Should we add this to the tutorial as a tip maybe? I haven't checked if its there already, but I can log an issue for this later.
Thanks so much for the clarification!
Last updated: Jul 05 2025 at 12:14 UTC