haskell / fgl

A Functional Graph Library for Haskell
http://hackage.haskell.org/package/fgl
Other
185 stars 54 forks source link

Informative error message for `insEdge` FIXES haskell/fgl#14 #15

Closed robstewart57 closed 9 years ago

robstewart57 commented 9 years ago

As documented in https://github.com/haskell/fgl/issues/14 , an irrefutable pattern exception is thrown when attempting to insert an edge from a vertex that does not exist in the graph, .e.g

insEdge (0,1,"foo") (mkGraph [] [])

The previous behaviour of fgl was:

mkGraph *\ Exception: Data/Graph/Inductive/Graph.hs:229:5-38: Irrefutable pattern failed for pattern (Just (pr, _, la, su), g')

The new behaviour is:

mkGraph *\ Exception: insEdge: unable to add edge from non-existent vertex 0