diff --git a/semantic.cabal b/semantic.cabal index f32a35d23..aa5191f67 100644 --- a/semantic.cabal +++ b/semantic.cabal @@ -148,6 +148,7 @@ library , Language.Java.Assignment , Language.Java.Grammar , Language.Java.Syntax + , Matching.Core , Numeric.Exts -- Parser glue , Parsing.CMark diff --git a/src/Matching/Core.hs b/src/Matching/Core.hs new file mode 100644 index 000000000..c0b08e747 --- /dev/null +++ b/src/Matching/Core.hs @@ -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