mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
Fix a bug that could cause "Prelude.head: empty list"
In Data.Operations, the function topoTest2 assumed too much about the form of the input, compared to the older function topoTest.
This commit is contained in:
@@ -266,8 +266,10 @@ topoTest = topologicalSort . mkRel'
|
||||
|
||||
-- | topological sorting with test of cyclicity, new version /TH 2012-06-26
|
||||
topoTest2 :: Ord a => [(a,[a])] -> Either [[a]] [[a]]
|
||||
topoTest2 g = maybe (Right cycles) Left (tsort g)
|
||||
topoTest2 g0 = maybe (Right cycles) Left (tsort g)
|
||||
where
|
||||
g = g0++[(n,[])|n<-nub (concatMap snd g0)\\map fst g0]
|
||||
|
||||
cycles = findCycles (mkRel' g)
|
||||
|
||||
tsort nes =
|
||||
|
||||
Reference in New Issue
Block a user