1
1
mirror of https://github.com/github/semantic.git synced 2024-12-29 18:06:14 +03:00

Term doesn't need to know about Record

This commit is contained in:
Timothy Clem 2018-09-21 09:42:24 -07:00
parent d656988dd0
commit dfe8c842ed
2 changed files with 4 additions and 6 deletions

View File

@ -10,14 +10,12 @@ module Data.Term
, termSize
, hoistTerm
, hoistTermF
, stripTerm
, Annotated (..)
) where
import Prologue
import Data.Aeson
import Data.JSON.Fields
import Data.Record
import Text.Show
import qualified Data.Sum as Sum
import Proto3.Suite.Class
@ -71,10 +69,6 @@ hoistTerm f = go where go (Term r) = Term (hoistTermF f (fmap go r))
hoistTermF :: (forall a. f a -> g a) -> TermF f a b -> TermF g a b
hoistTermF f = go where go (In a r) = In a (f r)
-- | Strips the head annotation off a term annotated with non-empty records.
stripTerm :: Functor f => Term f (Record (h ': t)) -> Term f (Record t)
stripTerm = fmap rtail
type instance Base (Term f a) = TermF f a

View File

@ -41,3 +41,7 @@ spec = parallel $ do
where decorate = defaultFeatureVectorDecorator
diffThese = these deleting inserting replacing
-- | Strips the head annotation off a term annotated with non-empty records.
stripTerm :: Functor f => Term f (Record (h ': t)) -> Term f (Record t)
stripTerm = fmap rtail