2 ms·
Hi In the case of events, it is because I later have to store different event types in a List so I define the list as [Event] . That is the container that fee
by agocorona 12y ago
Hi
In the case of events, it is because I later have to store different event types in a List
so I define the list as [Event] . That is the container that feed the monad with events.
If I define Event as you suggest, I would need a existential type anyway.
data Event a = Event EvType a
data ListEvents= forall a.[Event a]
In the case of the continuations, I need to use a state monad that store this EventF data And I need to "erase" in some way the types to allow it to store them all for all events, no matter wich a and b they produce. I know that if in
x :: IO a
f :: a -> m b
If within the monad definition I store f (the rest of the computation) in the state monad, the type of this continuation when executed will be (m b) and it accept values of type `a` so I can coerce the continuation to this type even if I "erased" it when i put it in the state monad.
Anyway this approach has some problems that I solved in the second part