I am trying to model multigraphs ....but getting errors with ghci and can't figure out why.... I have a serious blind spot ....
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.)
junk1.hs:19:12:
Constructor `Arrow' should have 1 argument, but has been given 0
In the pattern: Arrow
In the definition of `source': source Arrow = fst Arrow
In the instance declaration for `Graph Arrow Int'
It's asking "Arrow *what*?" 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).
> source (Arrow p) = fst p
> target (Arrow p) = snd p
Or you can use pattern matching to deconstruct the tuple as well:
> source (Arrow (f,_)) = f