mirror of
https://github.com/zhigang1992/graphql-engine.git
synced 2026-04-28 20:15:01 +08:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user