Hello,<br><br> I am trying to model multigraphs ....but getting errors with ghci and can't figure out why.... I have a serious blind spot ....<br><br><br>{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies #-}<br>
<br>module Bonzo where<br><br><br>class Graph arrow node where<br><br> source :: arrow -> node<br><br> target :: arrow -> node<br><br><br>data Arrow = Arrow (Int, Int)<br><br><br>instance Graph Arrow Int where<br>
<br> source Arrow = fst Arrow<br><br> target Arrow = snd Arrow <br><br>~ <br>~ <br>{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies #-}<br>
<br>module Bonzo where<br><br><br>class Graph arrow node where<br><br> source :: arrow -> node<br><br> target :: arrow -> node<br><br><br>data Arrow = Arrow (Int, Int)<br><br><br>instance Graph Arrow Int where<br>
<br> source Arrow = fst Arrow<br><br> target Arrow = snd Arrow <br><br>~ <br>~ <br><br><br>ghci> :load junk1.hs<br>
[1 of 1] Compiling Bonzo ( junk1.hs, interpreted )<br><br>junk1.hs:19:12:<br> Constructor `Arrow' should have 1 argument, but has been given 0<br> In the pattern: Arrow<br> In the definition of `source': source Arrow = fst Arrow<br>
In the instance declaration for `Graph Arrow Int'<br><br>junk1.hs:21:12:<br> Constructor `Arrow' should have 1 argument, but has been given 0<br> In the pattern: Arrow<br> In the definition of `target': target Arrow = snd Arrow<br>
In the instance declaration for `Graph Arrow Int'<br><br><br><br>Regards,<br><br>Vasili<br><br><br><br><br><br>