1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 08:54:07 +03:00

Some common matchers

This commit is contained in:
Timothy Clem 2018-08-14 14:15:18 -07:00
parent 487c78b854
commit cd65c8814a
2 changed files with 23 additions and 0 deletions

View File

@ -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
View 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