The most likely culprit is a layout error somewhere in your "..." that causes the two collides
lines to be separated into two separate blocks. Conflicting definitions for 'collides'
means that there are two different places in the same scope that are defining collides
. Somehow either those two lines are interrupted so the compiler sees them as separate, or there's an error in the "..." part that somehow defines collides
twice in one scope.
There are 2 main ways to trip the Conflicting definitions
error. First, two bindings in the same function definition can try to bind the same variable, as in foo x x = ...
. That's not allowed, because it defines x
twice.
The other (which is the one that I suspect applies in your code) is when two parts of the same definition are "interrupted" by another definition. The compiler sees that as two separate definitions. For example:
foo True = ...
bar = ...
foo False = ...
This is not allowed either, because it (again) defines the same name (foo
) twice.
The interruption may not be obvious, especially in cases where you accidentally mix tabs and spaces (and your editor uses something other than the 8 tabs per space that Haskell assumes). It can appear in your editor to be an indented line in a where clause but due to differences in tab width the compiler sees it aligned with foo
, making the second foo
into another definition conflicting with the first.
It is generally considered a good idea in layout-sensitive languages to only use spaces in your code, or at the very least to make sure that your editor is using the right number of spaces for its tabs. For Haskell, that is 8.