GHC 6.6 Data.Tuple incompatibility

Cale Gibbard cgibbard at gmail.com
Thu Oct 19 17:21:47 EDT 2006


Why are you not using a proper type?

Define
data Command = Cmd String (CommandHandler, (String, String))
and there will be no problem making that an instance of Eq and Ord in
the way you described.

On 19/10/06, John Goerzen <jgoerzen at complete.org> wrote:
> Hello,
>
> I had this code that worked in GHC 6.4:
>
> type CommandHandler = FTPServer -> String -> IO Bool
> type Command = (String, (CommandHandler, (String, String)))
>
> instance Eq Command where
>     x == y = (fst x) == (fst y)
> instance Ord Command where
>     compare x y = compare (fst x) (fst y)
>
> I am compiling with overlapping instances set.
>
> In GHC 6.6, this gives an error that Eq Command is a duplicate instance
> of one defined in Data.Tuple.  Commenting out that instance causes the
> Ord Command instance to fail because there is no Eq instance for
> CommandHandler.
>
> After discussing it with Ian Lynagh, his conclusion was that the problem
> is that Data.Tuple was not compiled with overlapping instances support,
> and that it probably ought to be.  He asked me to post here to see if
> everyone else felt the same way.
>
> Thanks,
>
> -- John
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
>


More information about the Libraries mailing list