You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The PureScript compiler seems to prevent the following monadMine instance from being created:
importPreludeimportControl.Monad.Aff (Aff)
importNetwork.HTTP.Affjax (AJAX)
classMonadm<=MonadMinemwheretest::Unit->mUnitinstancemonadMine :: MonadMine (Aff (ajax :: AJAX | e)) where
test _ = pure unit
(ignore that the ajax effect isn't actually used in the instance, that's just for simplifying the example. Imagine replacing the pure unit call with something that requires that effect)
It gives the following error:
Type class instance head is invalid due to use of type at line 8 col 1
( ajax :: AJAX
| e
)
All types appearing in instance declarations must be of the form T a_1 .. a_n, where each type a_i is of the same form.
in type class instance MonadHttp.MonadMine (Aff
( ajax :: AJAX
| e
)
)
To work around this, one must create a newtype to wrap the type being instanced, and then create the instance for that newtype instead. (Example)
Is there a reason why the PureScript compiler rejects using rows in the instance declaration? It seems like on face value that this should work.
The text was updated successfully, but these errors were encountered:
The PureScript compiler seems to prevent the following
monadMine
instance from being created:(ignore that the
ajax
effect isn't actually used in the instance, that's just for simplifying the example. Imagine replacing thepure unit
call with something that requires that effect)It gives the following error:
To work around this, one must create a newtype to wrap the type being instanced, and then create the instance for that newtype instead. (Example)
Is there a reason why the PureScript compiler rejects using rows in the instance declaration? It seems like on face value that this should work.
The text was updated successfully, but these errors were encountered: