Current section
Files
Jump to
Current section
Files
comparator
README.md
README.md
# comparatorCompare if two types have the same constructor in Gleam[](https://hex.pm/packages/comparator)[](https://hexdocs.pm/comparator/)```shgleam add comparator@1``````gleamimport comparator.{is_same_kind}type Size { Small Medium}type Variant { Primary Secondary}type Key { Size(Size) Variant(Variant)}pub fn main() -> Nil { assert is_same_kind(Size(Medium), Size(Small), True) == True assert is_same_kind(Size(Medium), Variant(Primary), False) == False assert is_same_kind(Variant(Primary), Variant(Primary), False) == True assert is_same_kind(Variant(Primary), Variant(Secondary), False) == True}```Further documentation can be found at <https://hexdocs.pm/comparator>.## Development```shgleam run # Run the projectgleam test # Run the tests```