In the section on EventWriterT, it talks about setting up a type ItemState. You can avoid writing the Semigroup and Monoid instances if you define it like:
(This makes it annoying to set up the lenses for the type, so maybe it's not worth it.)
Also, the docs recommend refactoring all the todo components into ... -> EventWriterT t ItemState m (), which works for everything except todoComplete (the checkbox), because you lose the information that it will only be an Event t (Bool -> Bool), which you do use within the component. This makes plumbing it through harder than it would otherwise be, because you have to runEventWriterT on the todoComplete, and then you only have an Endo TodoItem and you want an Endo Bool.
In the section on
EventWriterT
, it talks about setting up a typeItemState
. You can avoid writing theSemigroup
andMonoid
instances if you define it like:(This makes it annoying to set up the lenses for the type, so maybe it's not worth it.)
Also, the docs recommend refactoring all the todo components into
... -> EventWriterT t ItemState m ()
, which works for everything excepttodoComplete
(the checkbox), because you lose the information that it will only be anEvent t (Bool -> Bool)
, which you do use within the component. This makes plumbing it through harder than it would otherwise be, because you have torunEventWriterT
on thetodoComplete
, and then you only have anEndo TodoItem
and you want anEndo Bool
.