
Thanks for the reply - since you mentioned that it should work I figured there must’ve been a mistake somewhere else.
Looking closer I realised that when I copied & pasted the definition for (<) to the rest of the functions and the problem actually occurred at
...
max a b = max (size a) (size b)
min a b = min (size a) (size b)
…
which has return type of Double where it should be Cycle.
Regards,
Nicolaas
On 11 Oct 2014, at 15:39, Brandon Allbery
On Sat, Oct 11, 2014 at 9:02 AM, Nicolaas du Preez
wrote: data Cycle = Cycle { name :: String, size :: Double } deriving (Eq, Show) instance Ord Cycle where (<) a b = (<) (size a) (size b) -- problem statement! …
How can I specify that, on the right-hand side of the problem statement, I refer to (<) :: Double -> Double -> Bool instead of (<) :: Cycle -> Cycle -> Bool?
That should be automatic, since it knows that size :: Cycle -> Double and therefore should use the Double instance. Can you provide a minimal full example and full error message?
-- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners