module ArrowEnv(module Arrow, module ArrowEnv) where import Arrow -- more arrow classes (requires multiple parameter type classes) -- hugs -98 or ghc -fglasgow-exts -fallow-undecidable-instances class Arrow q => StateArrow s q where update :: (s->s) -> q a a -- Alternatives: -- fetch :: q a s -- store :: q s () -- update f = arr (\x->((),x)) >>> first (fetch >>> arr f >>> store) >>> arr snd -- updateAndReturn :: (s->s) -> q a s -- update state and return the old state. -- Impractical to use as a is thrown away. class Arrow q => ReaderArrow r q where poke :: (r->r) -> q a b -> q a b peek :: q a (r,a)