I have a general enum with three variants. I then have a function that should only work with two of those variants. It seems I should make a new type with just those two variants, but I can't figure out how to do that without coming up with new names.
Is this possible or is it necessary to come up with new names?
type MainType {
One
Two
Three
}
type NarrowedType {
One
Two
}
fn do_something(t: NarrowedType) {
case t {
One -> do_one()
Two -> do_two()
}
}
error: Duplicate definition
┌─ /path/to/src/narrow.gleam:8:3
│
2 │ One
│ ^^^ First defined here
·
8 │ One
│ ^^^ Redefined here
`One` has been defined multiple times.
Names in a Gleam module must be unique so one will need to be renamed.