
28 Jul
2014
28 Jul
'14
3:47 a.m.
* Magicloud Magiclouds
Hi,
For code like below, how to make it compilable?
data EventHandlers = forall m. MonadIO m => EventHandlers { onDeleteWindow :: Maybe (m ()) } instance Default EventHandlers where def = EventHandlers Nothing
GHC has to store some MonadIO dictionary in the existential type, but it cannot figure out which dictionary to store (it can be any). You can tell it which one to use by supplying a type annotation, e.g.: def = EventHandlers (Nothing :: Maybe (IO ())) Roman