patch applied (ghc): Teach :print to follow references (STRefs and IORefs)

pepe mnislaih at gmail.com
Wed Dec 5 10:01:57 EST 2007


On 05/12/2007, at 13:55, Simon Marlow wrote:

> Pepe Iborra wrote:
>> Tue Dec  4 02:55:11 PST 2007  Pepe Iborra <mnislaih at gmail.com>
>>  * Teach :print to follow references (STRefs and IORefs)
>>    Prelude Data.IORef> :p l
>>  l = (_t4::Maybe Integer) : (_t5::[Maybe Integer])
>>  Prelude Data.IORef> p <- newIORef l
>>  Prelude Data.IORef> :p p
>>  p = GHC.IOBase.IORef (GHC.STRef.STRef {((_t6::Maybe Integer) :
>>                                          (_t7::[Maybe Integer]))})
>>  Prelude Data.IORef> :sp p
>>  p = GHC.IOBase.IORef (GHC.STRef.STRef {(_ : _)})
>>      I used braces to denote the contents of a reference.
>>  Perhaps there is a more appropriate notation?
>
> Why not just
>
>  GHC.Prim.MutVar# <value>
>
> that seems to be the most obvious, if perhaps not the tidyest, way  
> to present it.  Do we really need a special syntax and to hide the  
> real primitive object here?

Sure. I agree that it is a bad idea and introduction of a new notation  
should be justified only if it significantly improves the end result.  
Something more like

  p = {(_t6::Maybe Integer) : (_t7::[Maybe Integer])})

would be what I originally had in mind, as opposed to

p = GHC.IOBase.IORef (GHC.STRef.STRef (GHC.Prim.MutVar# (_t6::Maybe  
Integer) :
                                                                                                                    (_t7 
::[Maybe Integer]))

which is rather longish. But on the other hand, it is more consistent  
with the behaviour of :print in other areas.
I'll prepare a patch if there is no further discussion.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/cvs-ghc/attachments/20071205/55d7b1ff/attachment-0001.htm


More information about the Cvs-ghc mailing list