mirror of
https://github.com/github/semantic.git
synced 2024-11-24 00:42:33 +03:00
Some common matchers
This commit is contained in:
parent
487c78b854
commit
cd65c8814a
@ -148,6 +148,7 @@ library
|
||||
, Language.Java.Assignment
|
||||
, Language.Java.Grammar
|
||||
, Language.Java.Syntax
|
||||
, Matching.Core
|
||||
, Numeric.Exts
|
||||
-- Parser glue
|
||||
, Parsing.CMark
|
||||
|
22
src/Matching/Core.hs
Normal file
22
src/Matching/Core.hs
Normal file
@ -0,0 +1,22 @@
|
||||
{-# LANGUAGE ScopedTypeVariables, TypeFamilies, TypeOperators #-}
|
||||
|
||||
module Matching.Core
|
||||
( matchHash
|
||||
, matchArray
|
||||
, matchFloat
|
||||
) where
|
||||
|
||||
import Prologue
|
||||
|
||||
import Control.Abstract.Matching
|
||||
import qualified Data.Syntax.Literal as Literal
|
||||
import Data.Term
|
||||
|
||||
matchHash :: (Literal.Hash :< fs, term ~ Term (Sum fs) ann) => Matcher term (Literal.Hash term)
|
||||
matchHash = matchM projectTerm target
|
||||
|
||||
matchArray :: (Literal.Array :< fs, term ~ Term (Sum fs) ann) => Matcher term (Literal.Array term)
|
||||
matchArray = matchM projectTerm target
|
||||
|
||||
matchFloat :: (Literal.Float :< fs, term ~ Term (Sum fs) ann) => Matcher term (Literal.Float term)
|
||||
matchFloat = matchM projectTerm target
|
Loading…
Reference in New Issue
Block a user