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. Re:  Parsec chapter in realworldhaskell (ch.16) (Benjamin Edwards)
   2. Re:  first open source haskell project and a      mystery to boot
      (Alia)
   3. Re:  first open source haskell project and a      mystery to boot
      (Alia)
   4.  help me with eroor (kolli kolli)
   5. Re:  help me with eroor (Daniel Fischer)
   6. Re:  help me with eroor (kolli kolli)
   7. Re:  help me with eroor (Daniel Fischer)
   8. Re:  help me with eroor (Brent Yorgey)


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

Message: 1
Date: Fri, 14 Oct 2011 11:03:12 +0100
From: Benjamin Edwards <edwards.b...@gmail.com>
Subject: Re: [Haskell-beginners] Parsec chapter in realworldhaskell
        (ch.16)
To: Obscaenvs <obscae...@gmail.com>
Cc: beginners@haskell.org
Message-ID:
        <CAN6k4nh_GMenwsCL=7pwn2-gboma7mdnixnyq69ssu+jr5e...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

It's not that it has no effect. If you have two parsers that have no common
initial productions then wrapping the first parser would have no effect.
That is the case here.

Just think of try as wrapping the stream / parser in a transaction. On
failure it rolls back.
On 14 Oct 2011 10:32, "Obscaenvs" <obscae...@gmail.com> wrote:

>  In http://book.realworldhaskell.org/read/using-parsec.html , under the
> heading "Extended example: Full CSV Parser", there is in the function
> quotedChar an occurrence of the operator <|> with a try after it (i.e. to
> the right) . Now, in this chapter it says a little before that "try only
> has an effect if it is on the left of a <|>.". So in this particular case,
> try has no effect, or?
>
> The offending code: <code>quotedChar = noneOf "\"" <|> try (string "\"\""
> >> return '"')</code>
>
> Help much appreciated, if not absolutely vital :)
>
> /Fredrik
>
> _______________________________________________
> 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/20111014/4258c87f/attachment-0001.htm>

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

Message: 2
Date: Fri, 14 Oct 2011 08:12:58 -0700 (PDT)
From: Alia <alia_kho...@yahoo.com>
Subject: Re: [Haskell-beginners] first open source haskell project and
        a       mystery to boot
To: "dmcbr...@neondsl.com" <dmcbr...@neondsl.com>
Cc: "beginners@haskell.org" <beginners@haskell.org>
Message-ID:
        <1318605178.19185.yahoomail...@web65711.mail.ac4.yahoo.com>
Content-Type: text/plain; charset=iso-8859-1

David McBride wrote:


> Sorry, it is the id3 function.? I'm not sure if the code ever worked,
> or if you are using it in a way that was not intended by the writer.
> It is because somehow xs because empty while attrs is not empty, then
> it tries to take the head of an empty list.? If you know what it
> should be doing well enough, you could fix it by giving it a valid
> case for when:

> id3 atts [] = ....

> Unfortunately I have no idea how this id3 function is supposed to work.

No worries. I appreciate you taking the time to have a look at this in any 
case. 

Best,

AK



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

Message: 3
Date: Fri, 14 Oct 2011 08:37:19 -0700 (PDT)
From: Alia <alia_kho...@yahoo.com>
Subject: Re: [Haskell-beginners] first open source haskell project and
        a       mystery to boot
To: "beginners@haskell.org" <beginners@haskell.org>
Message-ID:
        <1318606639.86380.yahoomail...@web65714.mail.ac4.yahoo.com>
Content-Type: text/plain; charset=iso-8859-1

Brent Yorgey wrote: 
> It must be a problem with the ID3 implementation itself.? 'items' is
> obviously not empty.? So the error must be coming from one of the
> calls to 'head' in the ID3 implementation (of which there are
> several).? The original author (whoever they were) ought to be ashamed
> of him/herself.? Having bugs in your implementation is excusable, but
> using functions like 'head' which can crash is not! ;)?

Thanks for confirming this. I think it's best not to waste any more time on 
this.

I appreciate your help in any case,

AK



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

Message: 4
Date: Fri, 14 Oct 2011 13:59:22 -0600
From: kolli kolli <nammukoll...@gmail.com>
Subject: [Haskell-beginners] help me with eroor
To: beginners@haskell.org
Message-ID:
        <CAE7D9k4G8FQDUBMgcCOq1=mkhferwcydl6xg3xsrfna-di2...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

import Text.ParserCombinators.Parsec

csvFile = endBy line eol
line = sepBy cell (char ',')
cell = many (noneOf ",\n")
eol = char '\n'

parseCSV :: String -> Either ParseError [[String]]
parseCSV input = parse csvFile "(unknown)" input

*showing error:
<interactive>:1:32: Not in scope: `main'
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20111014/be160744/attachment-0001.htm>

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

Message: 5
Date: Fri, 14 Oct 2011 22:08:21 +0200
From: Daniel Fischer <daniel.is.fisc...@googlemail.com>
Subject: Re: [Haskell-beginners] help me with eroor
To: beginners@haskell.org
Message-ID: <201110142208.21519.daniel.is.fisc...@googlemail.com>
Content-Type: Text/Plain;  charset="utf-8"

On Friday 14 October 2011, 21:59:22, kolli kolli wrote:
> import Text.ParserCombinators.Parsec
> 
> csvFile = endBy line eol
> line = sepBy cell (char ',')
> cell = many (noneOf ",\n")
> eol = char '\n'
> 
> parseCSV :: String -> Either ParseError [[String]]
> parseCSV input = parse csvFile "(unknown)" input
> 
> *showing error:
> <interactive>:1:32: Not in scope: `main'
> *

If you don't have a module declaration in your file, it is assumed to be

module Main (main) where

thus, if there's no main function, compilation fails.

Include a module declaration in your file,

module Whatever (parseCSV, csvFile, line, cell, eol) where

(the export list is optional, if you omit it, all top-level declarations 
are exported).



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

Message: 6
Date: Fri, 14 Oct 2011 14:49:04 -0600
From: kolli kolli <nammukoll...@gmail.com>
Subject: Re: [Haskell-beginners] help me with eroor
To: Daniel Fischer <daniel.is.fisc...@googlemail.com>
Cc: beginners@haskell.org
Message-ID:
        <cae7d9k5xw7v-ey48f_ma9zjffqw_1cqj-z7qbn550p4pj9u...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

namratha@ubuntu:~/Desktop$ runghc Main.hs

<interactive>:1:32: Not in scope: `main'



On Fri, Oct 14, 2011 at 2:45 PM, kolli kolli <nammukoll...@gmail.com> wrote:

> I am using ubuntu..i am running it in the terminal window....
>
>
> On Fri, Oct 14, 2011 at 2:36 PM, Daniel Fischer <
> daniel.is.fisc...@googlemail.com> wrote:
>
>> On Friday 14 October 2011, 22:26:45, you wrote:
>> > i gave
>> > module Main(csvFile, line) where
>> > import Text.ParserCombinators.Parsec
>> >
>> > csvFile = endBy line eol
>> > line = sepBy cell (char ',')
>> > cell = many (noneOf ",\n")
>> > eol = char '\n'
>> >
>> > parseCSV :: String -> Either ParseError [[String]]
>> > parseCSV input = parse csvFile "(unknown)" input
>> >
>> > its giving me the same error
>>
>> Did you try to run main from the ghci prompt?
>> The file loads without problems here.
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20111014/c45b8434/attachment-0001.htm>

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

Message: 7
Date: Fri, 14 Oct 2011 23:13:57 +0200
From: Daniel Fischer <daniel.is.fisc...@googlemail.com>
Subject: Re: [Haskell-beginners] help me with eroor
To: kolli kolli <nammukoll...@gmail.com>
Cc: beginners@haskell.org
Message-ID: <201110142313.57685.daniel.is.fisc...@googlemail.com>
Content-Type: Text/Plain;  charset="utf-8"

On Friday 14 October 2011, 22:49:04, kolli kolli wrote:
> namratha@ubuntu:~/Desktop$ runghc Main.hs
> 
> <interactive>:1:32: Not in scope: `main'

Yes, runghc needs a main function.
Load the file in ghci to try out normal functions.




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

Message: 8
Date: Fri, 14 Oct 2011 18:35:41 -0400
From: Brent Yorgey <byor...@seas.upenn.edu>
Subject: Re: [Haskell-beginners] help me with eroor
To: beginners@haskell.org
Message-ID: <20111014223541.ga1...@seas.upenn.edu>
Content-Type: text/plain; charset=us-ascii

By the way, if you need a CSV parser, there are several already on
Hackage: 'csv' [1] is the simplest; for more sophisticated uses there
are also bytestring-csv [2] and csv-enumerator [3].

But perhaps you are just writing a CSV parser in order to learn
Parsec; in which case, by all means carry on!

-Brent

[1] http://hackage.haskell.org/package/csv
[2] http://hackage.haskell.org/package/bytestring-csv
[3] http://hackage.haskell.org/package/csv-enumerator


On Fri, Oct 14, 2011 at 01:59:22PM -0600, kolli kolli wrote:
> import Text.ParserCombinators.Parsec
> 
> csvFile = endBy line eol
> line = sepBy cell (char ',')
> cell = many (noneOf ",\n")
> eol = char '\n'
> 
> parseCSV :: String -> Either ParseError [[String]]
> parseCSV input = parse csvFile "(unknown)" input
> 
> *showing error:
> <interactive>:1:32: Not in scope: `main'
> *

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




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

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


End of Beginners Digest, Vol 40, Issue 20
*****************************************

Reply via email to