I think I would opt for the very literal type Bla = A Int | B Int
type BlaConstructor = AConstructor | BConstructor blaConstructor : Bla -> BlaConstructor blaConstructor bla = case bla of A _ -> AConstructor B _ -> BConstructor haveSameConstructor : Bla -> Bla -> Bool haveSameConstructor firstBla secondBla = blaConstructor firstBla == blaConstructor secondBla The compiler will remind you to add a new case to the blaConstructor function when you add a new Bla constructor, and that in turn will prompt you to add a case to the BlaConstructor type - no tricky tuple matching required. I'm also guessing you can come up with a more meaningful name than 'constructor' (perhaps 'kind' or something) that better indicates what it actually means for an object to have a particular constructor. On Monday, 17 July 2017 13:22:56 UTC-4, David Andrews wrote: > > Similar code, with new cases enforced by the compiler > > haveSameConstructor : Bla -> Bla -> Bool > haveSameConstructor first second = > case (first, second) of > (A _, A _) -> True > (B _, B _) -> True > (A _, _) -> False > (B _, _) -> False > > On Jul 17, 2017 3:34 AM, "Birowsky" <biro...@gmail.com <javascript:>> > wrote: > >> That's not so bad. But the compiler wouldn't be able to nudge me to add a >> new comparison when I add a new constructor in the Bla union. >> >> Thanx anyways. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Elm Discuss" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to elm-discuss...@googlegroups.com <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.