Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Parser (Mike Houghton)
2. Re: Parser (Dennis J. McWherter, Jr.)
3. Re: Parser (Henk-Jan van Tuyl)
4. Re: How to check the help page of a function? (Henk-Jan van Tuyl)
5. Re: How to check the help page of a function? (Peng Yu)
6. Re: How to check the help page of a function? (Brandon Allbery)
7. Re: How to check the help page of a function? (Mike Meyer)
----------------------------------------------------------------------
Message: 1
Date: Sat, 16 May 2015 21:58:22 +0100
From: Mike Houghton <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: [Haskell-beginners] Parser
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"
Hi,
I?me writing a simple parser and can test it in GHCI
parseTest moveParser "(1,2)->(3,3)?
and I get what I expect i.e.
Move {from = Location 1 2, to = Location 3 3}
I now have a text file (test.txt) with lots of (1,2)->(3,3) (3,6)->(3,9) etc
etc and
I really can?t see how I get the contents of the text file into the parser!!
I have
main = do
handle <- openFile "test.txt" ReadMode
contents <- hGetContents handle
!! what goes here!!! - how do I invoke moveParser with contents ??
Thanks
Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20150516/da830564/attachment-0001.html>
------------------------------
Message: 2
Date: Sat, 16 May 2015 16:18:04 -0500
From: "Dennis J. McWherter, Jr." <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Parser
Message-ID:
<CABy4C_1s3PnpkQ6xAscUcq-H0p=M2RQ+39WG=zh3ec+phui...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
It's hard to say exactly, but assuming you have your file new line
delimited and you have a function signature like
moveParser :: String -> YOUR_TYPE
you can try something like this:
main = do
handle <- openFile "test.txt"
contents <- hGetContents handle
processedLines <- return (fmap moveParser $ lines contents)
hClose handle
Does this help?
Dennis
On Sat, May 16, 2015 at 3:58 PM, Mike Houghton <[email protected]>
wrote:
> Hi,
>
> I?me writing a simple parser and can test it in GHCI
>
> parseTest moveParser "(1,2)->(3,3)?
>
> and I get what I expect i.e.
> Move {from = Location 1 2, to = Location 3 3}
>
> I now have a text file (test.txt) with lots of (1,2)->(3,3) (3,6)->(3,9)
> etc etc and
> I really can?t see how I get the contents of the text file into the
> parser!!
>
> I have
> main = do
> handle <- openFile "test.txt" ReadMode
> contents <- hGetContents handle
> !! what goes here!!! - how do I invoke moveParser with contents ??
>
> Thanks
>
> Mike
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20150516/f6668f7c/attachment-0001.html>
------------------------------
Message: 3
Date: Sun, 17 May 2015 01:13:36 +0200
From: "Henk-Jan van Tuyl" <[email protected]>
To: "The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell" <[email protected]>,
"Mike Houghton" <[email protected]>
Subject: Re: [Haskell-beginners] Parser
Message-ID: <op.xyq343ejpz0j5l@alquantor>
Content-Type: text/plain; charset=iso-8859-15; format=flowed;
delsp=yes
On Sat, 16 May 2015 23:18:04 +0200, Dennis J. McWherter, Jr.
<[email protected]> wrote:
:
> processedLines <- return (fmap moveParser $ lines contents)
:
Or, a bit simpler:
let processedLines = fmap moveParser $ lines contents
Regards,
Henk-Jan van Tuyl
--
Folding@home
What if you could share your unused computer power to help find a cure? In
just 5 minutes you can join the world's biggest networked computer and get
us closer sooner. Watch the video.
http://folding.stanford.edu/
http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
Haskell programming
--
------------------------------
Message: 4
Date: Sun, 17 May 2015 01:16:44 +0200
From: "Henk-Jan van Tuyl" <[email protected]>
To: "The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell" <[email protected]>,
"Peng Yu" <[email protected]>
Subject: Re: [Haskell-beginners] How to check the help page of a
function?
Message-ID: <op.xyq396wfpz0j5l@alquantor>
Content-Type: text/plain; charset=iso-8859-15; format=flowed;
delsp=yes
On Sat, 16 May 2015 04:45:43 +0200, Peng Yu <[email protected]> wrote:
> Hi, I can not find how to check the help page of a function.
>
> For example, I want to check the help page of "head". How should I do
> it? (":help" doesn't seem to help.)
I generally use Hoogle:
https://www.fpcomplete.com/hoogle?q=head
and sometimes Hayoo:
http://hayoo.fh-wedel.de/?query=head
Regards,
Henk-Jan van Tuyl
--
Folding@home
What if you could share your unused computer power to help find a cure? In
just 5 minutes you can join the world's biggest networked computer and get
us closer sooner. Watch the video.
http://folding.stanford.edu/
http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
Haskell programming
--
------------------------------
Message: 5
Date: Sat, 16 May 2015 18:18:50 -0500
From: Peng Yu <[email protected]>
To: Henk-Jan van Tuyl <[email protected]>
Cc: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] How to check the help page of a
function?
Message-ID:
<CABrM6w=qty2p2ghf-a3-mqa5bsg-strpohsdvpsmrffmqcm...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
Many other languages have help pages in the command (see help() in
python and R). Why haskell doesn't have such a feature?
On Sat, May 16, 2015 at 6:16 PM, Henk-Jan van Tuyl <[email protected]> wrote:
> On Sat, 16 May 2015 04:45:43 +0200, Peng Yu <[email protected]> wrote:
>
>> Hi, I can not find how to check the help page of a function.
>>
>> For example, I want to check the help page of "head". How should I do
>> it? (":help" doesn't seem to help.)
>
>
> I generally use Hoogle:
> https://www.fpcomplete.com/hoogle?q=head
> and sometimes Hayoo:
> http://hayoo.fh-wedel.de/?query=head
>
> Regards,
> Henk-Jan van Tuyl
>
>
> --
> Folding@home
> What if you could share your unused computer power to help find a cure? In
> just 5 minutes you can join the world's biggest networked computer and get
> us closer sooner. Watch the video.
> http://folding.stanford.edu/
>
>
> http://Van.Tuyl.eu/
> http://members.chello.nl/hjgtuyl/tourdemonad.html
> Haskell programming
> --
--
Regards,
Peng
------------------------------
Message: 6
Date: Sat, 16 May 2015 19:30:30 -0400
From: Brandon Allbery <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] How to check the help page of a
function?
Message-ID:
<CAKFCL4WVa=mmn9koj49ivv4hmmfbyr+fybegfpcrh1y9juj...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
On Sat, May 16, 2015 at 7:18 PM, Peng Yu <[email protected]> wrote:
> Many other languages have help pages in the command (see help() in
> python and R). Why haskell doesn't have such a feature?
>
Because Haskell doesn't predate the web? :p
You can build local documentation and access it from ghci with some hooks
(see https://wiki.haskell.org/Ghci#Package_and_documentation_lookup
although it's a bit outdated), but Haskell is not a dynamic language and
ghci is not trying to be its primary developer interface. And you can't
exactly hyperlink on a terminal.
--
brandon s allbery kf8nh sine nomine associates
[email protected] [email protected]
unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20150516/c2a980c7/attachment-0001.html>
------------------------------
Message: 7
Date: Sat, 16 May 2015 19:16:48 -0500
From: Mike Meyer <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] How to check the help page of a
function?
Message-ID:
<CAD=7u2duu16ccpamwxigxhgc1gags2pt28yk2bkfdu9pyda...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
On Sat, May 16, 2015 at 6:30 PM, Brandon Allbery <[email protected]>
wrote:
> On Sat, May 16, 2015 at 7:18 PM, Peng Yu <[email protected]> wrote:
>
>> Many other languages have help pages in the command (see help() in
>> python and R). Why haskell doesn't have such a feature?
>>
>
> Because Haskell doesn't predate the web? :p
>
So do Python. And S, for that matter.
I don't know about R, but it's a fundamentally harder problem in a Haskell
environment than in a Python one. Python forces you to keep the sources
around, which has the doc strings in them, and has places to put doc
strings in the data describing it's internal objects. So the "help"
function is just a tool for examining those. Python's package installation
is also more amenable to such, which gives us pydoc instead of hoogle.
> You can build local documentation and access it from ghci with some hooks
> (see https://wiki.haskell.org/Ghci#Package_and_documentation_lookup
> although it's a bit outdated),
>
Maybe https://wiki.haskell.org/Hoogle#GHCi_Integration would be less
outdated?
> but Haskell is not a dynamic language and ghci is not trying to be its
> primary developer interface. And you can't exactly hyperlink on a terminal.
>
In that case, you need a more powerful web browser. Or to (as the hoogle
command does) install local copies of the documentation.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20150516/4c673e7a/attachment.html>
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 83, Issue 45
*****************************************