Skip to content

Commit

Permalink
Add sanity check to makePassiveSet.
Browse files Browse the repository at this point in the history
  • Loading branch information
nick8325 committed Sep 13, 2017
1 parent 572bf1d commit da4c97a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Twee/PassiveQueue.hs
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,12 @@ unpack proxy rule isLeft (score, id, pos) =
{-# INLINEABLE makePassiveSet #-}
makePassiveSet :: forall params. Params params => Id params -> [Passive params] -> Maybe (PassiveSet params)
makePassiveSet _ [] = Nothing
makePassiveSet rule ps =
mkPassiveSet proxy rule
(Vector.fromList (map (pack True) (sort left)))
(Vector.fromList (map (pack False) (sort right)))
makePassiveSet rule ps
| and [passive_rule2 p == rule | p <- right] =
mkPassiveSet proxy rule
(Vector.fromList (map (pack True) (sort left)))
(Vector.fromList (map (pack False) (sort right)))
| otherwise = error "rule id does not occur in passive"
where
proxy :: Proxy params
proxy = Proxy
Expand Down

0 comments on commit da4c97a

Please sign in to comment.