gleam-lang/gleam
View on GitHubUnbound type variable in top level definition after type inference
Open
#2,533 opened on Jan 9, 2024
help wanted
Description
In this case, after type inference, the main function ends up having an inferred type with an unbound type variable instead of a generic one:
pub type Foo(a) {
Foo(value: Int)
}
pub fn main() {
Foo(1)
}
Adding a type annotation turns the variable into a generic one though:
// now the inferred type has a generic type variable instead
// of an unbound one
pub fn main() -> Foo(a) { ... }