
28 Jul
2014
28 Jul
'14
3:50 a.m.
I see. Thank you.
Any anyway I could use (MonadIO m) here, in Nothing data type?
On Mon, Jul 28, 2014 at 3:47 PM, Roman Cheplyaka
* Magicloud Magiclouds
[2014-07-28 13:46:53+0800] 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
-- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com.