Send Beginners mailing list submissions to
        beginners@haskell.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        beginners-requ...@haskell.org

You can reach the person managing the list at
        beginners-ow...@haskell.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1.  Parsec Library Questions (Sean Cormican)
   2. Re:  Parsec Library Questions (mukesh tiwari)
   3. Re:  Parsec Library Questions (Brandon Allbery)
   4. Re:  Parsec Library Questions (Kim-Ee Yeoh)


----------------------------------------------------------------------

Message: 1
Date: Tue, 22 Jan 2013 12:52:50 +0000
From: Sean Cormican <seancormic...@gmail.com>
Subject: [Haskell-beginners] Parsec Library Questions
To: beginners@haskell.org
Message-ID:
        <caf6xeqdxbxpbhvloq4jn6g4xajvjfjveuucldxmopjr31rn...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

I'm currently trying to run through this tutorial on the Parsec Library
http://legacy.cs.uu.nl/daan/download/parsec/parsec.html#operator
and I have a few basic questions that I'm hoping someone might be able to
shed some light on.

1. I seem to be having some issues with importing Parsec modules for
instance.
"import Parsec" as outlined in the introduction causes errors as does a
number of the imports used later on in the paper and a solution that I have
found is to further specify "import Text.Parsec" is this due to some
changes to importing since the paper was written (in 2001 I believe)?

2. Can anyone recommend if this is a good source to learn to use the Parsec
Library or if there are any other recommended documents I would benefit
from ?

3. I have also tried to run the files that I have created in hugs and ghc
and while they work in ghc, hugs on the other hand complains about the
import statements I making e.g. "import Text.Parsec.Expr"

Thanks in advance for any help!!
Se?n
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20130122/ca664ab2/attachment-0001.htm>

------------------------------

Message: 2
Date: Tue, 22 Jan 2013 18:47:12 +0530
From: mukesh tiwari <mukeshtiwari.ii...@gmail.com>
Subject: Re: [Haskell-beginners] Parsec Library Questions
To: Sean Cormican <seancormic...@gmail.com>
Cc: beginners@haskell.org
Message-ID:
        <cafhzve_mj_kmiqktz3hords0avb8yi2ew9bso-tzgaejouc...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hi Sean


On Tue, Jan 22, 2013 at 6:22 PM, Sean Cormican <seancormic...@gmail.com>wrote:

> I'm currently trying to run through this tutorial on the Parsec Library
> http://legacy.cs.uu.nl/daan/download/parsec/parsec.html#operator
> and I have a few basic questions that I'm hoping someone might be able to
> shed some light on.
>
> 1. I seem to be having some issues with importing Parsec modules for
> instance.
> "import Parsec" as outlined in the introduction causes errors as does a
> number of the imports used later on in the paper and a solution that I have
> found is to further specify "import Text.Parsec" is this due to some
> changes to importing since the paper was written (in 2001 I believe)?
>

Initial version of Parsec was written using state monad and later  it was
written  using  monad transformar library so I guess this could be a
reason. May be some one with more experience in parsec can explain it.


>
> 2. Can anyone recommend if this is a good source to learn to use the
> Parsec Library or if there are any other recommended documents I would
> benefit from ?
>

Here are couple of links and you can search more files on github.
1. http://www.vex.net/~trebla/haskell/parsec-generally.xhtml
2.
http://dl.dropbox.com/u/7810909/docs/haskell-parsers/haskell-parsers/html/index.html
3. http://en.wikibooks.org/wiki/Write_Yourself_a_Scheme_in_48_Hours/Parsing
4. https://github.com/jhartikainen/hs-language-php/blob/master/Tokenizer.hs
5. http://www.haskell.org/haskellwiki/Parsing_expressions_and_statements
6. http://www.haskell.org/haskellwiki/Parsing_a_simple_imperative_language
7.
https://github.com/tomahawkins/verilog/blob/master/Language/Verilog/Parser.hs


> 3. I have also tried to run the files that I have created in hugs and ghc
> and while they work in ghc, hugs on the other hand complains about the
> import statements I making e.g. "import Text.Parsec.Expr"
>
> Thanks in advance for any help!!
>

Mukesh


> Se?n
>
> _______________________________________________
> Beginners mailing list
> Beginners@haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20130122/45b28b43/attachment-0001.htm>

------------------------------

Message: 3
Date: Tue, 22 Jan 2013 10:18:41 -0500
From: Brandon Allbery <allber...@gmail.com>
Subject: Re: [Haskell-beginners] Parsec Library Questions
To: Sean Cormican <seancormic...@gmail.com>
Cc: beginners@haskell.org
Message-ID:
        <cakfcl4xle6o4mey2vjmmrpeu0pnthyrpeepkwg4ervsjda1...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

On Tue, Jan 22, 2013 at 7:52 AM, Sean Cormican <seancormic...@gmail.com>wrote:

> 1. I seem to be having some issues with importing Parsec modules for
> instance.
> "import Parsec" as outlined in the introduction causes errors as does a
> number of the imports used later on in the paper and a solution that I have
> found is to further specify "import Text.Parsec" is this due to some
> changes to importing since the paper was written (in 2001 I believe)?
>

Flat Haskell98 modules are no longer used; they pollute the namespace.
 Additionally, the Parsec3 API was for a time not 100% backward compatible
(and may still require type annotations sometimes) and at one point was
significantly slower than Parsec2, so it was relocated in order to allow
them to coexist in a somewhat comprehensible way.


> 3. I have also tried to run the files that I have created in hugs and ghc
> and while they work in ghc, hugs on the other hand complains about the
> import statements I making e.g. "import Text.Parsec.Expr"
>

hugs is no longer maintained; I doubt it can handle Parsec3 fully.  If for
some reason you must use Hugs, you might want to stick to Parsec2.

-- 
brandon s allbery kf8nh                               sine nomine associates
allber...@gmail.com                                  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20130122/53b33e87/attachment-0001.htm>

------------------------------

Message: 4
Date: Wed, 23 Jan 2013 03:42:23 +0700
From: Kim-Ee Yeoh <k...@atamo.com>
Subject: Re: [Haskell-beginners] Parsec Library Questions
To: Sean Cormican <seancormic...@gmail.com>
Cc: "beginners@haskell.org" <beginners@haskell.org>
Message-ID:
        <CAPY+ZdQs1Xy1bt2YPw9SAUtnKoS_X1PZq=fwoygruuqsh3j...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

On Tue, Jan 22, 2013 at 7:52 PM, Sean Cormican <seancormic...@gmail.com>wrote:

> 2. Can anyone recommend if this is a good source to learn to use the
> Parsec Library or if there are any other recommended documents I would
> benefit from ?
>

I think Daan wrote a lucid if slightly  bitrotted parsec tutorial (and not
just parsec itself) that many library users can benefit from. In addition,
it gives a good glimpse of the thinking behind the library design. If only
more libraries on hackage were similarly documented.

For a grasp of the evolution from the pre- to the post-monad picture, I'd
also recommend the following sources cited in the tutorial. The Monad and
MonadPlus instances act as familiar sugar over the otherwise more brittle
code that results from working with the combinators directly. The sugar is
translated away eventually, so it's still necessary to grasp the underlying
higher-order functions.

Graham Hutton. (1992)
Higher-order functions for parsing.
Journal of Functional Programming 2: 232-343.
http://www.cs.nott.ac.uk/Department/Staff/gmh/parsing.ps.

Graham Hutton and Erik Meijer. (1996)
Monadic Parser Combinators.
Technical report NOTTCS-TR-96-4. Department of Computer Science, University
of Nottingham.
http://www.cs.nott.ac.uk/Department/Staff/gmh/monparsing.ps.

And also the chapter in Hutton's textbook.

It's also useful to know that parser combinators vs parser generators (like
yacc and happy) are good examples of shallow- vs deeply-embedded DSLs. Many
of the relative advantages of each aren't specific to parsing but apply
generally to the shallow vs deep divide. <---- Digressing further, let me
just note that much of the knowledge of DSL design and implementation is
folklore for which there's no good source of information. One could do
worse than take parsing as a case study and go from there.

-- Kim-Ee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20130123/ecc451a6/attachment-0001.htm>

------------------------------

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 55, Issue 25
*****************************************

Reply via email to