<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
I don't understand your question but the class Ord in Data.Ord is
our tool for comparisons. You may want to look into that. You can
also<br>
use the function "on" from Data.Function to compare on a specific
record within a larger structure.<br>
<br>
Dimitri<br>
<br>
<br>
<div class="moz-cite-prefix">On 11/24/15 11:20 AM, Jeon-Young Kang
wrote:<br>
</div>
<blockquote
cite="mid:CALWtiK_Gtsw2j9_EtcvGAHssinpf5rhm=YYr0T2_QJzJ0gzWnQ@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>Dear All.</div>
<div><br>
</div>
<div>I'd like to compare fields of each record.</div>
<div><br>
</div>
<div>here is my record.</div>
<div><br>
</div>
<div>data Person = Person {name:: String, age:: Int }
deriving(Show)</div>
<div>data Relations = Friend | Older | Younger<br>
</div>
<div><br>
</div>
<div>class Comparison a where</div>
<div> compare:: a -> a -> Relations</div>
<div><br>
</div>
<div>instance Comparison Person where</div>
<div> compare Person a b Person a b</div>
<div> | b1 == b2 = Friend</div>
<div> | b1 > b2 = Older</div>
<div> | b1 < b2 = Younger</div>
<div><br>
</div>
<div>How can I fit it?</div>
<div><br>
</div>
<div>Sincerely,</div>
<div><br>
</div>
<div class="gmail_signature">
<div dir="ltr">
<div> </div>
<div>Jeon-Young Kang</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Beginners mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Beginners@haskell.org">Beginners@haskell.org</a>
<a class="moz-txt-link-freetext" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a>
</pre>
</blockquote>
<br>
</body>
</html>