1
1
mirror of https://github.com/github/semantic.git synced 2025-01-02 20:41:38 +03:00

Specialize decompose to Syntax.

This commit is contained in:
Rob Rix 2017-02-23 16:54:08 -05:00
parent fe6d54ae04
commit 5223c2c59f

View File

@ -109,9 +109,9 @@ runAlgorithm recur = iterAp $ \ r cont -> case r of
where maybeRecur a b = if comparable a b then Just (recur (These a b)) else Nothing where maybeRecur a b = if comparable a b then Just (recur (These a b)) else Nothing
-- | Decompose a step of an algorithm into the next steps to perform. -- | Decompose a step of an algorithm into the next steps to perform.
decompose :: (Eq1 f, GAlign f, Traversable f, HasField fields Category, HasField fields (Maybe FeatureVector)) decompose :: (Eq leaf, HasField fields Category, HasField fields (Maybe FeatureVector))
=> AlgorithmF (Term f (Record fields)) (Diff f (Record fields)) result -- ^ The step in an algorithm to decompose into its next steps. => AlgorithmF (Term (Syntax leaf) (Record fields)) (Diff (Syntax leaf) (Record fields)) result -- ^ The step in an algorithm to decompose into its next steps.
-> Algorithm (Term f (Record fields)) (Diff f (Record fields)) result -- ^ The sequence of next steps to undertake to continue the algorithm. -> Algorithm (Term (Syntax leaf) (Record fields)) (Diff (Syntax leaf) (Record fields)) result -- ^ The sequence of next steps to undertake to continue the algorithm.
decompose = \case decompose = \case
Diff t1 t2 -> case (unwrap t1, unwrap t2) of Diff t1 t2 -> case (unwrap t1, unwrap t2) of
_ -> byReplacing t1 t2 _ -> byReplacing t1 t2