I tried doing some modularization on my project by extracting some functions/types i would be using multiple times. But now that I'm importing type Node defined in util_generators.gleam file using the unqualified import like showed in Langauge Tour it can't seem to recognize it and i don't want to add the qualificator? Am I doing something wrong?
#Unqualified type imports not working?
1 messages ยท Page 1 of 1 (latest)
If you have this code:
pub type Node {
Node(...)
}
Then you import the type Node with .{type Node} and you import the constructor Node with .{Node}. If you want both type and constructor, you can do .{type Node, Node} in your import
Hello! Could you share the definition of Node? I have a hunch of what might be wrong but it's always best to make sure ๐
Oh I see, that worked. Thanks
Ah I see, so here you're defining a type called Node with a single constructor with the same name as the type
By doing import util_generators.{type Node} you're just importing the type and not the constructor
Oh greenfork beat me to it ๐
Sorry ๐
Thanks to you both for help anyways ๐
Also, one more quick question if you are still here. Is there a way to read user input from command line after running the project? Not how it's done with argv package