How to convert Dynamic to Forall something

Viewed 346

I have a cache with Dynamic values. Some of them have the type Delayed a.

Normally when I access the cache, I know the type a, so it's not a problem, I can use fromDynamic to cast to Maybe a.

I would like to call a function which doesn't need to know anything about the type a on a list of Dynamic. (The method is cancel :: Delay a -> IO ()). Is there a way to do so ?

Basically I need a way to do get from Dynamic to Forall a . Delayed a ?

Edit

For information, Delayed holds a pending asynchronous value and a MVar to start or Cancel it. It is equivalent to

 data Delayed m a = Delayed { blocker :: MVar Bool, async :: Async m a }

Such values are stored in a cache (which use Dynamic and store other things). When displaying the cache status, I need to be able to get the status of Delayed value (which involve accessing the blocker but has nothing to do with the actual value.

2 Answers
Related