gleam-lang / language-tour

👩🏽‍💻 Learn Gleam in your browser
https://tour.gleam.run/
82 stars 62 forks source link

No output at all when destructuring a bit array #101

Open michallepicki opened 4 months ago

michallepicki commented 4 months ago

Two examples, I'm told first one should result in a run-time crash:

import gleam/io

pub fn main() {
  let assert <<"\n":utf8, tail>> = <<"\ngoodbye":utf8>>
  io.debug(tail)
}

and this one I would expect to print the bytes of goodbye:

import gleam/io

pub fn main() {
  let assert <<"\n":utf8, tail:bytes>> = <<"\ngoodbye":utf8>>
  io.debug(tail)
}

edit: or maybe actually both should be compiler errors about the utf8 option on js target

lpil commented 4 months ago

Thank you