Your professor is probably using an older version of GHC. The line you posted uses a feature which has quite recently been removed. The possible solutions are:
Remove Eq a =>
and write data Shape a = Shape a
.
As GHC says, give the -XDatatypeContexts
flag to re-enable the removed feature.
In more detail: the Eq a =>
part of your type declaration is called a datatype context. Its only function is to restrict the type of the Shape
constructor, so that instead of Shape :: a -> Shape a
you get Shape :: Eq a => a -> Shape a
. It does not save you from having to write Eq a
in type signatures involving Shape
s, and indeed will even require you to write them when you wouldn't otherwise need to. It was once useful when strict fields in datatypes required a class constraint, but that feature was removed long ago.
In short, just removing the context is nearly always an improvement to your program, so they were removed from the Haskell 2011 language standard. Since GHC 7.0.1 there has been an option to turn them off and since 7.2.1 it has been the default.