[Yhc] instance Monad IO bug

Donald Bruce Stewart dons at cse.unsw.edu.au
Sun Mar 11 07:24:42 EDT 2007


isaacdupree:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> for a file
> main = print "hi" >> return undefined >> print "bye"
> ghc, hugs and nhc98 print
> "hi"
> "bye"
> yhc prints
> "hi"
> Prelude.undefined
> 
> In other words, IO's (>>=) and (>>) (defined in
> src/packages/yhc-base-1.0/Prelude.hs) are too strict. (at least I assume
> that behavior is considered wrong...)
> 
> I can't see a simple way to fix it, given Yhc's representation of IO (no
> other compiler, not even nhc98, uses newtype IO a = IO (World -> a)),
> but maybe someone else does.  Maybe an artificial "dependingOn", like
> seq but that doesn't even evaluate its argument to WHNF, is needed?
> (inspired by jhc's primitive dependingOn :: a -> b -> a, which is the
> OPPOSITE argument order (like const, rather than seq) and I'm not sure
> if it has the semantics I'm suggesting, but, whatever...)
> 

I wonder if this explains the weird too-much-work done bug in the 
calendar  benchmark:

    http://www.cse.unsw.edu.au/~dons/code/nobench/spectral/calendar 

where:
    nhc98       yhc
    0.04 (0.0)  97.24 (26.8)

(also listed on the bug tracker).

Something wrong in the monad immplementation anyway.

-- don


More information about the Yhc mailing list