Not sure what is the expected behavior here, but I think maybe it should be a compile-error (similar to when exposing types that are not public)
I have the following in my example:
wobble.gleam
pub type Api {
Api(method: fn(String) -> String)
}
pub const api1 = Api(impl)
fn impl(s: String) {
"Prefix " <> s
}
wibble.gleam
import wobble.{api1}
import gleam/io
pub fn main() {
api1.method("test")
|> io.debug()
}
When running with:
gleam run -m wibble
I get the following error:
exception error: undefined function wobble:impl/1
in function wibble:main/0 (/Users/john.bjork/git/glimt/build/dev/erlang/glimt/_gleam_artefacts/wibble.erl, line 8)