Hi,

Given a complete graph as a list of nodes whose edge labels are given by
a function over two nodes:

data CGraph a b = CGraph [a] (a -> a -> b)

Can I define an instance for the fgl Graph class?

import Data.Graph.Inductive.Graph

instance Graph CGraph where
  empty = CGraph []  -- and now?

I had no idea how to define empty (except using undefined).

I thought of requiring a context for the node labels of type a, but this
type is not mentioned in the class header. So it looked to me like the
impossibility to define sets (requiring an Ord) as monads. (i.e.
instance Monad Data.Set.Set)

Any working proposals for my graph problem?

Cheers Christian
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to