I find it a little hard to understand your code but here's what I think
is going on:

1) You're using the Maybe type to get a simple form of error-handling -
   your function returns "Just x" if things work fine and "Nothing"
   if a problem occurs.

2) The returned value is a large data structure (instead of some atomic
   value like an Int or Float).

3) It is impossible to get part of the answer without checking that the
   entire answer will be available (ie no errors occur anywhere) - which
   requires that you calculate the entire answer.  This is a feature of
   this style of error handling --- it makes your program much stricter.

   (An identical problem occurs with the parsing monad - you can't
   access the result of a parse until parsing completes.)   

I'm not sure what the best solution to your problem is but I'd
consider changing the type:

  Maybe [x]

to

  [Maybe x]

so that each part of the answer could be accessed independently of the
others.

--
Alastair Reid              Yale Haskell Project Hacker
[EMAIL PROTECTED]  http://WWW.CS.Yale.EDU/homes/reid-alastair.html

  

Reply via email to