[Haskell-cafe] Eq Type Class: Overloading (==)

ChrisK chrisk at MIT.EDU
Sat Sep 17 00:27:59 EDT 2005


You would have to preempt the Standard Prelude. For ghc there is a
command line switch I have neer used: -fno-implicit-prelude

See section 7.3.5 in the GHC user's guide for more.

There are some internal caveats:

"However, the standard Prelude Eq class is still used for the equality
test necessary for literal patterns."



Tom Hawkins wrote:
> Hello,
> 
> Is it possible to overload (==) to a type other than a -> a -> Bool?
> 
> I have an abstract datatype that somewhat behaves like a C integer: a
> comparison returns a boolean represented as the same datatype:
> 
> (==) :: my_type -> my_type -> my_type
> 
> Thanks for any help!
> 
> -Tom
> 
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe


More information about the Haskell-Cafe mailing list