Skip to content

Instantly share code, notes, and snippets.

@robkuz
Created April 26, 2016 11:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robkuz/02a840ff140202d263803e233d1ea2e4 to your computer and use it in GitHub Desktop.
Save robkuz/02a840ff140202d263803e233d1ea2e4 to your computer and use it in GitHub Desktop.
Using a synonym for a Monad

Id like to make the signature of foo a bit better readable

foo :: forall e m. (MonadAff (ajax :: AJAX | e) m) => m (Either Error (AffjaxResponse Json))

What I'd like to do is

type AjaxAff = MonadAff (ajax :: AJAX | e)
foo :: forall m. (AjaxAff m) => m (Either Error (AffjaxResponse Json))

but this gives me

type AjaxAff = MonadAff (ajax :: Affjax.AJAX | e)
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Unknown type MonadAff

Which I find a bit strange as it doesnt complain about the type MonadAff in the first example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment