<div dir="ltr">If all you want to do is check that the code is valid (i.e., you aren&#39;t going to interpret the code), you can just return a Bool.  If you want to interpret it, but don&#39;t want to have a Stmt type, you can return IO () actions.  In that case, the parser&#39;s type will be<div>
<br></div><div>Parser (IO ())<br><div><br></div><div style>I think an algebraic AST (or even a functorial/monadic one) will help separate concerns, and will eventually help when it comes time to optimize your compiler.  It really isn&#39;t as much boilerplate as it looks like (in fact, there&#39;s hardly any boilerplate if you target free monads and interpret those in IO), and you get the type safety for which Haskell is well-known.</div>
</div><div style><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Feb 19, 2013 at 3:02 PM, Sean Cormican <span dir="ltr">&lt;<a href="mailto:seancormican1@gmail.com" target="_blank">seancormican1@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I have been trying to create a parser for a functional programming language, but there is no need to create an AST but merely check that the code is valid according to the grammar.<div>
<br></div><div>In the following tutorial I have been trying to take some pointers from, data declarations are used to create an AST for the language, There is, as I understand a way to parse the language without an AST. </div>

<div><br></div><div><a href="http://www.haskell.org/haskellwiki/Parsing_a_simple_imperative_language" target="_blank">http://www.haskell.org/haskellwiki/Parsing_a_simple_imperative_language</a><br></div><div><br></div><div>

My question is what should the type signatures for example parseFile function instead of &quot;Stmt&quot; accept as input if the parser is to accept Strings and numerical expressions alike ? </div><div><br></div><div>
Thanks for any help,</div><div>Seán </div></div>
<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>
<br></blockquote></div><br></div>