<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>