[Yhc] coreFunc has extra argument

Tom Shackell shackell at cs.york.ac.uk
Tue Mar 4 11:11:20 EST 2008


Tom Shackell wrote:
 > The value of World comes up in only two places that I know of.

Ah I lie, the final use of World is in the Show instance of the IO Monad.

instance (Show a) => Show (IO a) where
   ...

   showsType (IO fta) = showString "(IO " . showsType ta . showChar ')'
         where (_E  ta) = fta World

Interestingly this applies World to the IO action, however, since the 
only thing that is done with the result is 'showsType' the computation 
is never actually evaluated (since you don't need to evaluate it to know 
its type).

Though why this doesn't just use unsafePerformIO I don't know ...

  showsType io = showString "(IO " . showsType a . showChar ')'
       where
       a = unsafePerformIO io

This would work just as well. *shrugs* Yhc has quite a lot of historical 
carry-overs from nhc98 :)


Cheers


Tom


More information about the Yhc mailing list