#1683: strange MVar / UnsafePerformIO (and type checker...) behaviour
---------------------------------------------------+------------------------
Reporter: [EMAIL PROTECTED] | Owner:
Type: bug | Status: closed
Priority: normal | Milestone:
Component: Compiler | Version: 6.6.1
Severity: normal | Resolution: invalid
Keywords: MVar, UnsafePerformIO, typechecker | Difficulty: Unknown
Os: Unknown | Testcase:
Architecture: Unknown |
---------------------------------------------------+------------------------
Comment (by guest):
Dear Ian,
I would be happy if you could elaborate on your comment, which I think I
don't really understand.
Also, with all respects, I still think that there is something fishy going
here...
For example, introduce the following function:
{{{
ejnye = do
putMVar a (-5)
x <- readMVar a
y <- readMVar b
print (x,y)
return (x,y)
}}}
Now, a ghci session:
{{{
*Main> :t ejnye
ejnye :: IO (Int, Word8)
*Main> ejnye
(-5,-5)
(-5,-5)
}}}
So basically, ghci tells me that `y` has type `Word8`; but how is it
possible to print a negative number as the value of `y::Word8`? You can go
further, like:
{{{
*Main> (x,y) <- ejnye
*Main> :t x
x :: Int
*Main> :t y
y :: Word8
*Main> x
-5
*Main> y
-5
*Main> let y' = (-5) :: Word8
*Main> y'
251
*Main> y == y'
False
}}}
(It is of course very possible that there is something fundamental I don't
understand here, in which case I would like to ask you to enlighten me)
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1683>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs