1
1
mirror of https://github.com/github/semantic.git synced 2024-12-19 12:51:52 +03:00

Generalize liftAnalyze to any base functor.

This commit is contained in:
Rob Rix 2018-03-22 13:45:46 -04:00
parent ae7483291a
commit b353b1aa5d

View File

@ -108,10 +108,10 @@ load name = askModuleTable >>= maybe notFound evalAndCache . moduleTableLookup n
-- | Lift a 'SubtermAlgebra' for an underlying analysis into a containing analysis. Use this when defining an analysis which can be composed onto other analyses to ensure that a call to 'analyzeTerm' occurs in the inner analysis and not the outer one.
liftAnalyze :: ( Coercible ( m term value (effects :: [* -> *]) value) (t m term value effects value)
, Coercible (t m term value effects value) ( m term value effects value)
, Functor (Base term)
, Functor base
)
=> SubtermAlgebra (Base term) term ( m term value effects value)
-> SubtermAlgebra (Base term) term (t m term value effects value)
=> SubtermAlgebra base term ( m term value effects value)
-> SubtermAlgebra base term (t m term value effects value)
liftAnalyze analyze term = coerce (analyze (second coerce <$> term))