Skip to content

Instantly share code, notes, and snippets.

@kremovtort
Created February 21, 2020 09:17
Show Gist options
  • Save kremovtort/ec16684e98197723328844eee6370512 to your computer and use it in GitHub Desktop.
Save kremovtort/ec16684e98197723328844eee6370512 to your computer and use it in GitHub Desktop.
error in EitherC
type CarrierKind = (Type -> Type) -> Type -> Type
data ((t :: CarrierKind) :|: (u :: CarrierKind)) (m :: Type -> Type) (a :: Type) = EitherC
{ runLeft :: t m a
, runRight :: u m a }
deriving Functor
instance
( MonadBaseControl b (t m), MonadBaseControl b (u m)
, forall x . StM (t m) x ~ StM (u m) x )
=> MonadBaseControl b ((t :|: u) m) where
type StM ((t :|: u) m) a = StM (u m) a
liftBaseWith f = EitherC left right
where
left = liftBaseWith \h -> f \(EitherC l _) -> h l
right = liftBaseWith \h -> f \(EitherC _ r) -> h r
-- • Couldn't match type ‘StM (t m) a1’ with ‘StM (u m) a1’
-- Expected type: b (StM ((:|:) t u m) a1)
-- Actual type: b (StM (t m) a1)
-- NB: ‘StM’ is a non-injective type family
-- • In the expression: h l
-- In the second argument of ‘($)’, namely ‘\ (EitherC l _) -> h l’
-- In the expression: f $ \ (EitherC l _) -> h l
-- • Relevant bindings include
-- l :: t m a1 (bound at src/EitherC.hs:??:??)
-- h :: Control.Monad.Trans.Control.RunInBase (t m) b
-- (bound at src/EitherC.hs:??:??)
-- left :: t m a (bound at src/EitherC.hs:??:?)
-- right :: u m a (bound at src/EitherC.hs:??:?)
-- f :: Control.Monad.Trans.Control.RunInBase ((:|:) t u m) b -> b a
-- (bound at src/Metasearch/Aviasales/ABTest.hs:82:16)
-- liftBaseWith :: (Control.Monad.Trans.Control.RunInBase
-- ((:|:) t u m) b
-- -> b a)
-- -> (:|:) t u m a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment