1
1
mirror of https://github.com/github/semantic.git synced 2024-12-24 15:35:14 +03:00

Define a convenience to unwrap and project.

This commit is contained in:
Rob Rix 2017-03-26 18:03:27 -04:00
parent 76218f1b9f
commit 2ab72ea378

View File

@ -13,6 +13,10 @@ data Union (ts :: [* -> *]) (a :: *) where
wrapU :: (MonadFree (Union fs) m, InUnion fs f) => f (m a) -> m a wrapU :: (MonadFree (Union fs) m, InUnion fs f) => f (m a) -> m a
wrapU = wrap . emb wrapU = wrap . emb
-- | Unwrap a cofree comonad and project a functor from the resulting union.
unwrapU :: (ComonadCofree (Union fs) w, InUnion fs f) => w a -> Maybe (f (w a))
unwrapU = proj . unwrap
-- Classes -- Classes