Stephen Tetley

Results 40 comments of Stephen Tetley

Question 1 Yes (I think) if the functor implementation of `map` goes left to right (caveat below). Question 2 Probably not. The documentation for Haskell's `Traversable` class makes the strong...

> Foldable I don't think so - you want both the container (rebuilt / mapped) and the summary value. You can't rebuild the container with just `Foldable` the fold step...

I've made a version of `Traversable` where `ContStateLeft` and `ContStateRight` thread a region rather than IO so the effects of `map` and `ap` can be internally cast to the region...

I've made the PR - #4460.

I don't really understand why StateRight works - you can implement it without CPS but then it isn't stack safe. Basically it has the evaluation order of `Applicative.ap` changed so...

> But I don't see how to get accumRight from this. We could just provide `mapAccumLeft` as Traversable should be explicitly left-to-right. With a ref cell for the interim state...

> Can we live without mapAccumRight? I'm happy without it, until there's a good solution for the "function monads" and effects problem...

It's inconvenient that they are different but I wouldn't want to lose the `Result` version as it makes clear that a parse failure is an `Err`. Maybe the `Result` version...

> @stephentetley Any reason why `Option.toErr("message here")` and just returning an Option is insufficient? That's fine actually - mostly I wrap `Int32.fromString` in some sort of parsing monad so supplying...

@mlutze - have you seen this? https://homepages.dcc.ufmg.br/~camarao/controlling-the-scope-of-instances-in-Haskell-sblp2011.pdf