I have a type
type T s r a = StateT [s] (ListT (Reader r)) a
I’d like to create a monadic value that yields each of the current states
states :: T a r a
But I’m feeling stupid today, and I can’t figure out how to transform a value of T a r [a] to T a r a.
states = do
as <- get
-- insert magic
return a
Figured a way out
Which can be compacted down to
ok, feel smarter now