If I understand you correctly, what you want is very similar to catMaybes<br><br><span style="font-family: courier new,monospace;">isSuccess&#39; (Success a) = Just a</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">isSuccess&#39; _ = Nothing</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">result = catMaybes $ map isSuccess ps</span><br><br>This should do the trick.<br><br><br><div class="gmail_quote">2010/1/7 rodrigo.bonifacio <span dir="ltr">&lt;<a href="mailto:rodrigo.bonifacio@uol.com.br">rodrigo.bonifacio@uol.com.br</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi all,<br>
<br>
I have a family of parsers that return either (Success t) or (Fail), using the following data type:<br>
<br>
&gt; data ParserResult a = Success a | Fail String<br>
&gt;  deriving (Read, Show, Eq, Ord)<br>
&gt;<br>
&gt; isSuccess (Success _) = True<br>
&gt; isSuccess (Fail _) = False<br>
&gt; ...<br>
<br>
I want to add the results of different parsers to a list. Such as:<br>
<br>
&gt; m1 = parseFirstModel file1   -- it returns a ParserResult of t1<br>
&gt; m2 = parseSecondModel file2  -- it returns a ParserResult of t2<br>
<br>
&gt; ps = [m1, m2]<br>
<br>
In such a way that I could write something like:<br>
<br>
&gt; if and (map isSuccess ps)<br>
&gt;  then process m1 m2<br>
&gt;  else ...<br>
<br>
Actually, in the real program I have to check more than two input models. However, since Lists do only hold elements of a same type, I couldn&#39;t proceed in this way. Which improvements to the ParserResult data type should I wrote in order to proceed as I want to.<br>

<br>
Best regards,<br>
<br>
Rodrigo.<br>
 <br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Ozgur Akgun<br>