1
1
mirror of https://github.com/github/semantic.git synced 2024-12-23 14:54:16 +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 = 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