Hacker News new | ask | show | jobs
by hyperman1 806 days ago
In rust, you are required to annotate at least the interface. In Haskell, if I remember it well, it is allowed but not required.

Even in Rust, I tend to specify types at variable bindings if the type gets overly complex, just to push errors closer to their cause.

A nice feature of Rust is you can specify partial types, wih underscores for the still-to-infer part. E.g. let x:Vec<_>=someexpression; is a vector of something, but you don't know what exactly.

1 comments

> you can specify partial types, wih underscores for the still-to-infer part

Yup. I love that. And it even lets you say things like for example:

    let res: Result<Vec<_>, _> = someexpression;