<div dir="ltr">On Tue, Sep 13, 2011 at 00:08, Vasili I. Galchin <span dir="ltr">&lt;<a href="mailto:vigalchin@gmail.com">vigalchin@gmail.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
      I am trying to model multigraphs ....but getting errors with ghci and can&#39;t figure out why.... I have a serious blind spot ....<br></blockquote><div><br></div><div>Why do you need to use classes for this?  (Note:  forget everything you know about classes from OOP.  Haskell typeclasses have approximately nothing to do with OOP.)</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">junk1.hs:19:12:<br>    Constructor `Arrow&#39; should have 1 argument, but has been given 0<br>    In the pattern: Arrow<br>
    In the definition of `source&#39;: source Arrow = fst Arrow<br>
    In the instance declaration for `Graph Arrow Int&#39;<br></blockquote><div><br></div><div>It&#39;s asking &quot;Arrow *what*?&quot;  You specified Arrow as taking a tuple argument; if you want to use it here, you need to provide that argument (or a placeholder, but in this case you clearly want the tuple).</div>
<div><br></div><div>&gt;   source (Arrow p) = fst p</div><div>&gt;   target (Arrow p) = snd p</div><div><br></div><div>Or you can use pattern matching to deconstruct the tuple as well:</div><div><br></div><div>&gt;   source (Arrow (f,_)) = f</div>
</div><div>&gt;   target (Arrow (_,t)) = t</div><div><br></div>-- <br>brandon s allbery                                      <a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a><br>wandering unix systems administrator (available)     (412) 475-9364 vm/sms<br>
<br>
</div>