Well, Ghc 7.10 is planned to have Stack Traces, which should be exposed as part of the Exceptions data model once that gets added, I believe that will help quite a bit! -Carter On Thu, Mar 13, 2014 at 1:09 PM, Ruud Koot <r.koot@uu.nl> wrote:
On Thu, Mar 13, 2014 at 5:54 PM, Roman Cheplyaka <roma@ro-che.info> wrote:
Simply instantiating b with b `Throws` e gives
map :: (a -> b `Throws` e) -> [a] -> [b `Throws` e]
Which is actually a more useful type than the one you proposed, because it shows that map itself doesn't throw exceptions (so that e.g. computing length is safe).
Assuming "Throws e" is a monad, you could use mapM instead of map to get the behavior you want.
In fact, Throws will probably need to be an indexed monad.
Roman
Yes, lazyness complicates things even further. You can pass a function to map that produces an "exception value" of type b. These exceptions would be attached to the elements inside the list [b] as you suggest. But there might also be exceptional values hidden inside the spine of the second argument of type [a]. These would need to end up in the spine of the resulting list of type [b].
Ruud _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe