<div dir="ltr">Apologies - sent too soon - code edited below<div class="gmail_extra"><div class="gmail_quote"><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Dear All,<div><br></div><div>I am having problems writing a polymorphic function.</div><div><br></div><div>I have a type that has two constructors:</div><div><br></div><div><div>data Arg = IndArg {evi::Evi, t1::Treatment, t2::Treatment, out::Outcome, dir::Direction}</div><div>            | MetaArg {target::EviType}</div><div>            deriving (Show)</div></div><div><br></div><div>I have a function checks for conflict:</div><div><br></div><div><div>checkConflict :: Arg -> Arg -> Bool</div><div>checkConflict a b = if t1 a == t1 b && t2 a == t2 b && dir a /= dir b then True</div><div>                     else False<br></div></div><div><br></div><div>However, I can't make this work with both types of Argument - if I pass it MetaArg, it raises an error.</div><div><br></div><div>In another language, I would write something like:</div><div><br></div><div>checkConflict(ArgA,ArgB):</div></div></blockquote><div>         if type(ArgA) == IndArg:</div><div>                  <do this></div><div>         elif type(ArgA) == MetaArg:</div><div>                  <do other></div><div><br></div><div>Any thoughts would be welcomed.</div><div><br></div><div>BW,</div><div>Matt</div><div><br></div></div><br></div></div>