[Haskell-cafe] better error expression in IO function

Aaron Tomb atomb at soe.ucsc.edu
Fri Jul 13 18:53:15 EDT 2007


I have written up the beginnings of some code to get Yahoo Finance  
quotes, too. Perhaps we should compare notes, and try to put  
something together that uses the best ideas from each attempt?

Aaron

On Jul 11, 2007, at 12:57 PM, brad clawsie wrote:

> i am working on improving a module for getting Yahoo Finance quote
> data, hopefully getting it to a point that i can put it on hackage
>
> in the quote retrieval function, there are a few places i would like
> to call out errors. in a trivial case i could return
>
> IO (Maybe String)
>
> with Nothing signifying any error state, or Just expressing the data
>
> but i would like to be able to express some of these error cases in a
> more structured manner
>
> i know the Either type can be used in such a case(?), but i've had  
> some
> problem locating a satisfactory example (if this is indeed
> appropriate)
>
> could one of the vets here provide a simplistic example expressing
> error cases, preferrably in the IO Monad (in case there are any
> gotchas there)?
>
> thanks so much!
> brad
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe



More information about the Haskell-Cafe mailing list