mirror of
https://github.com/github/semantic.git
synced 2024-12-22 14:21:31 +03:00
📝 the Eval instance for Union.
This commit is contained in:
parent
2044714a5a
commit
c6e086d208
@ -29,6 +29,7 @@ class Monad m => Eval term v m constr where
|
|||||||
default eval :: (MonadFail m, Show1 constr) => ((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 ""
|
eval _ _ expr = fail $ "Eval unspecialized for " ++ liftShowsPrec (const (const id)) (const id) 0 expr ""
|
||||||
|
|
||||||
|
-- | If we can evaluate any syntax which can occur in a 'Union', we can evaluate the 'Union'.
|
||||||
instance (Monad m, Apply (Eval t v m) fs) => Eval t v m (Union fs) where
|
instance (Monad m, Apply (Eval t v m) fs) => Eval t v m (Union fs) where
|
||||||
eval ev yield = apply (Proxy :: Proxy (Eval t v m)) (eval ev yield)
|
eval ev yield = apply (Proxy :: Proxy (Eval t v m)) (eval ev yield)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user