mirror of
https://github.com/github/semantic.git
synced 2024-12-21 05:41:54 +03:00
Define a helper to match context infix.
This commit is contained in:
parent
d1ee070aa8
commit
82b1bc1f87
@ -9,6 +9,7 @@ import Data.Align.Generic
|
||||
import Data.ByteString (ByteString)
|
||||
import qualified Data.Error as Error
|
||||
import Data.Foldable (toList)
|
||||
import Data.Function ((&))
|
||||
import Data.Ix
|
||||
import Data.List.NonEmpty (NonEmpty(..), nonEmpty)
|
||||
import Data.Functor.Classes.Eq.Generic
|
||||
@ -67,6 +68,14 @@ postContextualize context rule end = make <$> rule <*> Assignment.manyThrough co
|
||||
Just cs -> (makeTerm1 (Context cs node), end)
|
||||
_ -> (node, end)
|
||||
|
||||
infixContext :: (Context :< fs, Alternative m, Semigroup a, HasCallStack, Apply1 Foldable fs)
|
||||
=> m (Term (Union fs) a)
|
||||
-> m (Term (Union fs) a)
|
||||
-> m (Term (Union fs) a)
|
||||
-> [m (Term (Union fs) a -> Term (Union fs) a -> Union fs a)]
|
||||
-> m (Union fs a)
|
||||
infixContext context left right operators = uncurry (&) <$> postContextualize context left (Assignment.choice operators) <*> right
|
||||
|
||||
|
||||
-- Undifferentiated
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user