[Hugs-users] Comparing TRex records
ross at soi.city.ac.uk
Wed Jan 18 16:56:09 EST 2006
On Wed, Jan 18, 2006 at 04:28:25PM -0500, Lajos Nagy wrote:
> I tried to create a set of records using Data.Set but it turns out that
> Rec doesn't implement Ord. Is there a nice solution or you need a new
> builtin function to do the trick?
> Sample code:
> Main> Data.Set.mkSet [(a="apple"), (a="peach")]
> ERROR - Unresolved overloading
> *** Type : Ord (Rec (a :: [Char])) => Set (Rec (a :: [Char]))
> *** Expression : mkSet [(a = "apple"),(a = "peach")]
> If a new builtin is needed, any pointers where to start?
A new builtin is needed. Eq and Show are implemented using eqRecRow and
showRecRow in Hugs.Trex, which are picked up in trexLoad() and used in
primRecEq and primRecShw. See also addRecEqInst() and addRecShowInst().
Ord would need something similar.
First you'd have to decide what it should mean.
More information about the Hugs-Users