Closed xhh closed 8 months ago
import gleam/io
import gleam/string.{inspect}
import snag.{type Snag, Snag}
pub fn main() {
let r: Snag = snag.Snag("hello", [])
// or:
// let r: snag.Snag = Snag("hello", [])
io.println(inspect(r))
}
In the above code, the latter Snag
import shoud be a warning of Unused imported item
, but there's none.
Hi there! If you want to import a type the syntax is import module.{type TypeName}
. If you want to import a value the syntax is import module.{Value}
. If you want to import a type and a value with the same name you'll need to import them both.
The dead code detection feature of the compiler is due to be rewritten in 2024, it does not detect all dead code today.
This might not relate to
snag
, but to Gleam.Code:
Error:
It's OK if change that line to (but
import snag.{Snag}
becomes an "Unused imported item" warning):and this also works: