[Yhc] instance Monad IO bug

Isaac Dupree isaacdupree at charter.net
Sun Mar 11 07:16:11 EDT 2007


-----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...)

Isaac
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF8+T6HgcxvIWYTTURAlDyAJ4omDQnum4klKb+tD+p3PMFwRwZawCfZLjV
vBZPV5y9j/uVI0Lf58nxKBA=
=H9Lt
-----END PGP SIGNATURE-----


More information about the Yhc mailing list