How to read `liftAff` signature?

Hi,

module Effect.Aff.Class where
...
foreign import data Aff :: Type -> Type

class MonadEffect m <= MonadAff m where
  liftAff :: Aff ~> m

m type requires a parameter, doesn’t it?
So liftAff returns unsaturated type?!

What is the difference with the signature below:

class MonadEffect m <= MonadAff m where
  liftAff :: Aff a -> m a

Hi!
Does this help? (You can just search ~> on Pursuit to find it).
I don’t believe there is any difference between Aff ~> m and forall a. Aff a ~> m a

2 Likes

Notice that the arrow ~> is squiggly. Not a regular function arrow. So m is not a return type of liftAff. It’s the second parameter of type ~>, which is an alias for NaturalTransformation, which is defined as:

type NaturalTransformation f g = forall a. f a -> g a

Which means that the signature Aff ~> m is equivalent to forall a. Aff a -> m a

2 Likes