typelead / eta

The Eta Programming Language, a dialect of Haskell on the JVM
https://eta-lang.org
BSD 3-Clause "New" or "Revised" License
2.61k stars 145 forks source link

Program with multiple clauses and guards fails to compile #467

Open rahulmutt opened 7 years ago

rahulmutt commented 7 years ago
data Color = Red | Blue | Green | Color Int Int Int

equalsColor :: Color -> Color -> Bool
equalsColor Red Red = True
equalsColor Blue Blue = True
equalsColor Green Green = True
equlasColor (Color r1 g1 b1) (Color r2 g2 b2)
  | r1 == r2 && g1 == g2 && b1 == b2 = True
equalsColor _ _ = False

This program fails to compile with the "Multiple declarations with names differing only in case." error. @pparkkin That looks like a renamer error you introduced - can you take a look?

For some reason, the compiler thinks the first couple clauses and the last clause are distinct.

pparkkin commented 7 years ago

I'll take a look.

pparkkin commented 7 years ago

There's a typo in the (Color ...) (Color ...) line. It says equlasColor.

pparkkin commented 7 years ago

The error message "names differing only in case" shouldn't really be there, though. I get the regular "Multiple declarations" error too, which is the correct one here.

rahulmutt commented 7 years ago

Apologise for that - I'm sleep deprived.

Yeah, are you doing the case check a bit earlier than needed?