1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 22:31:36 +03:00

Relax eval constaints for more choice in control flow

This commit is contained in:
Timothy Clem 2017-11-29 13:55:46 -08:00
parent 355ec2aa5e
commit e336e8735e

View File

@ -23,8 +23,8 @@ import Prelude hiding (fail)
-- Collecting evaluator
class Monad m => Eval term v m constr where
eval :: ((v -> m v) -> term -> m v) -> (v -> m w) -> constr term -> m w
default eval :: (MonadFail m, Show1 constr) => ((v -> m v) -> term -> m v) -> (v -> m w) -> constr term -> m w
eval :: ((v -> m v) -> term -> m v) -> ((v -> m v) -> constr term -> m v)
default eval :: (MonadFail m, Show1 constr) => ((v -> m v) -> term -> m v) -> ((v -> m v) -> constr term -> m v)
eval _ _ expr = fail $ "Eval unspecialized for " ++ liftShowsPrec (const (const id)) (const id) 0 expr ""
instance (Monad m, Apply (Eval t v m) fs) => Eval t v m (Union fs) where