[Haskell-cafe] Just 3 >>= (1+)?

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Sat May 9 18:16:07 EDT 2009

On May 9, 2009, at 18:03 , Miguel Mitrofanov wrote:
> On 10 May 2009, at 00:30, Brandon S. Allbery KF8NH wrote:
>> On May 9, 2009, at 15:31 , michael rice wrote:
>>> Prelude> Just 3 >>= (1+)
>> That (a -> m b) in the middle is what's failing to typecheck.  The  
>> error is a bit obtuse because ghci is trying hard to find a way to  
>> do what you want, so it assumes "m" is "(-> r)" (the functor/monad  
>> representing functions, also known as the Reader monad)
> Ehm? What? I haven't seen the (-> r) monad anywhere near this code.

That's the only way I can get the error he got; if it uses Maybe as  
the monad then why is the Maybe on the *inside* in the error message?   
Clearly it bound m to something else, and ((->) r) is the only other  
one I can think of applying there.  (Hm, I suppose it could be IO  
forced by the ghci context, but I didn't think it worked that way.)

brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20090509/47ae1bd1/PGP.bin

More information about the Haskell-Cafe mailing list