server: Fix buggy rewrite rule for Rule

We’re lucky that this never bit us. For the most part, these rules
aren’t actually used; most code programs against ArrowCache and doesn’t
get specialized enough for these rules to fire.

Even if we did have code that could trigger this rule, the situations
where it would actually fire are slim. In order for the rule to
typecheck at all, both sides of the pair being passed through the arrow
must have exactly the same type. Of course, that would just make this
even more hellish to debug.

Rewrite rules are dangerous.
This commit is contained in:
Alexis King
2020-03-14 20:38:26 -05:00
parent 28e2b2d51d
commit b65e9fc1b2

View File

@@ -118,7 +118,7 @@ rFirst (Rule r) = Rule \s (a, c) k -> r s a \s' b r' -> k s' (b, c) (rFirst r')
{-# INLINABLE[0] rFirst #-}
{-# RULES
"first/id" rFirst rId = rId
"first/arr" forall f. rFirst (rArr f) = rArr (second f)
"first/arr" forall f. rFirst (rArr f) = rArr (first f)
"first/arrM" forall f. rFirst (rArrM f) = rArrM (runKleisli (first (Kleisli f)))
"first/push" [~1] forall f g. rFirst (f `rComp` g) = rFirst f `rComp` rFirst g
"first/pull" [1] forall f g. rFirst f `rComp` rFirst g = rFirst (f `rComp` g)