On Tue, Apr 18, 2017, 16:02 Joshua Grosso mailto:jgrosso1@asu.edu> wrote:
/If/ I'm understanding correctly, GHCI's complaining about the fact that `return 2` requires it to create an instance of a `Monad`, but it doesn't know which `Monad` instance it should use...
Does `let (x, y) = (1, return 2) :: (Int, Maybe Int)` work (where you can replace `Maybe` with any other monad)?
Hi Joshua,
Thanks for the input. You are correct that if I choose a particular Monad instance GHCi accepts the code.
I believe it should be able to do the assignment without choosing one though. It is, for example, okay with let y = return 2.
I'm thinking Sergiu is onto something about this having to do with special GHCi handling.
Thanks! -Tyson