[Haskell-cafe] better error expression in IO function
brad clawsie
clawsie at fastmail.fm
Wed Jul 11 15:57:53 EDT 2007
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
More information about the Haskell-Cafe
mailing list