[Haskell-cafe] Weird defaulting on newEmptyTMVar

Ruben Astudillo ruben.astud at gmail.com
Sun Feb 10 03:24:52 UTC 2019


Dear list

Playing on ghci I encountered the following type

    GHCi, version 8.6.3: http://www.haskell.org/ghc/  :? for help
    Prelude> :m +Control.Concurrent.STM
    Prelude Control.Concurrent.STM> var1 <- atomically $ newEmptyTMVar
    Prelude Control.Concurrent.STM> :t var1
    var1 :: TMVar GHC.Types.Any
    Prelude Control.Concurrent.STM>

I would think `var1 :: TMVar a` as the documentation says it should.
Reading on `GHC.Types` `Any` seems to be a type family related to some
laws on `unsafeCoerce`. Can anybody explain me why is this sensible
defaulting and how to obtain the expected result?

-- 
-- Ruben
-- pgp: 4EE9 28F7 932E F4AD


More information about the Haskell-Cafe mailing list