#referencing a type variant

1 messages · Page 1 of 1 (latest)

lime comet
#

hey, I'm having trouble figuring out how to reference type variants for imported types.

for instance, I have this at the top of my file:

import gleam/http.{type Header, type Method, type Scheme}

but then, when I try to build a request it can't resolve the Https variant of Scheme:

pub fn new() -> request.Request(a) {
  request.new()
  |> request.set_scheme(Https) // <- The name `Https` is not in scope here.
}

i feel like there's some concept I'm missing when it comes to namespacing / modules since this isn't an issue with local type variants

mortal hound
#

You'll need to either write http.Https or import it with import gleam/http.{Https}