1
1
mirror of https://github.com/github/semantic.git synced 2024-12-26 08:25:19 +03:00

Unpack a few fields.

This commit is contained in:
Rob Rix 2017-06-15 09:36:04 -04:00
parent 7e05cec95f
commit b5cb522d62

View File

@ -42,13 +42,13 @@ type FeatureVector = UArray Int Double
-- | A term which has not yet been mapped by `rws`, along with its feature vector summary & index.
data UnmappedTerm f fields = UnmappedTerm {
termIndex :: Int -- ^ The index of the term within its root term.
, feature :: FeatureVector -- ^ Feature vector
termIndex :: {-# UNPACK #-} !Int -- ^ The index of the term within its root term.
, feature :: {-# UNPACK #-} !FeatureVector -- ^ Feature vector
, term :: Term f (Record fields) -- ^ The unmapped term
}
-- | Either a `term`, an index of a matched term, or nil.
data TermOrIndexOrNone term = Term term | Index Int | None
data TermOrIndexOrNone term = Term term | Index {-# UNPACK #-} !Int | None
rws :: (HasField fields (Maybe FeatureVector), Functor f, Eq1 f)
=> (Diff f fields -> Int)