[Haskell-cafe] Why this existential type could not work?

Magicloud Magiclouds magicloud.magiclouds at gmail.com
Thu Aug 21 06:36:52 UTC 2014


  For example, code like this:

newtype Sealed = Sealed { unSealed :: forall a. SomeClass a => TVar a }

mkSealed :: (SomeClass a) => a -> IO Sealed
mkSealed = fmap Sealed . newTVarIO

  When compiling, I would get:

Expected type: a -> IO (forall a1. SomeClass a1 => TVar a1)
Actual type: a -> IO (TVar a)

  How to correctly restrict type parameter a here?


And for G+, please use magiclouds#gmail.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140821/61e13364/attachment.html>

More information about the Haskell-Cafe mailing list