Send Beginners mailing list submissions to
[email protected]
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
[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. "Developing Web Applications with Haskell and Yesod"
(KMandPJLynch)
2. Re: "Developing Web Applications with Haskell and Yesod"
(Brent Yorgey)
3. Question about Ord for lists and multi-dimensional lists
(Tyler Huffman)
4. Re: Question about Ord for lists and multi-dimensional lists
(Mateusz Kowalczyk)
5. Re: Question about Ord for lists and multi-dimensional lists
(Tyler Huffman)
6. Re: foldr problem (Roelof Wobben)
----------------------------------------------------------------------
Message: 1
Date: Sun, 02 Mar 2014 19:53:52 -0500
From: KMandPJLynch <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] "Developing Web Applications with Haskell
and Yesod"
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii
I'm reading the O'Reilly book "Developing Web Applications with Haskell and
Yesod" but can't get the helloworld.hs app, from the book, to work.
This is what I did:
1. I downloaded Haskell and it works just fine.
2. cabal update
3. cabal install yesod
4. I downloaded the helloworld.hs program - see following:
{-# LANGUAGE TypeFamilies, QuasiQuotes, MultiParamTypeClasses,
TemplateHaskell, OverloadedStrings #-}
import Yesod
data HelloWorld = HelloWorld
mkYesod "HelloWorld" [parseRoutes] / HomeR Get|]
instance Yesod HelloWorld
getHomeR :: Handler RepHtml
getHomeR = defaultLayout [whamlet[|Hell World!|]
main :: IO ()
main = warpDebug 3000 HelloWorld
5. I went to the terminal on a Mac and entered command: runhaskell helloworld.hs
6. on the terminal the following is displayed: Hell World!
7. I opened a Safari browser and entered: http://localhost:3000
8. the following error message is displayed:
"Safari can't connect to Server.
Safari can't open the page http://localhost:3000/ because Safari can't
connect to localhost"
I'd appreciate any help.
------------------------------
Message: 2
Date: Sun, 2 Mar 2014 21:33:07 -0500
From: Brent Yorgey <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] "Developing Web Applications with
Haskell and Yesod"
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii
On Sun, Mar 02, 2014 at 07:53:52PM -0500, KMandPJLynch wrote:
> 7. I opened a Safari browser and entered: http://localhost:3000
> 8. the following error message is displayed:
> "Safari can't connect to Server.
> Safari can't open the page http://localhost:3000/ because Safari can't
> connect to localhost"
Try a different browser. I think I've heard similar problems
mentioned before where the problem was some bug/lack of feature in
Safari.
-Brent
------------------------------
Message: 3
Date: Sun, 2 Mar 2014 22:33:50 -0700
From: Tyler Huffman <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] Question about Ord for lists and
multi-dimensional lists
Message-ID:
<CAMYb46Acr=tvwpof44c-3q3wbon_yvbjtjvwvregocnmwza...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Hi all,
I'm having trouble finding resources explaining how Ord for two lists works.
I've created a public gist to explain what I mean.
https://gist.github.com/iduhetonas/9318958
Could anybody shed some light on what I'm seeing?
Regards,
Tyler Huffman
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140302/80da8e58/attachment-0001.html>
------------------------------
Message: 4
Date: Mon, 03 Mar 2014 05:44:58 +0000
From: Mateusz Kowalczyk <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] Question about Ord for lists and
multi-dimensional lists
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8
On 03/03/14 05:33, Tyler Huffman wrote:
> Hi all,
>
> I'm having trouble finding resources explaining how Ord for two lists works.
>
> I've created a public gist to explain what I mean.
>
> https://gist.github.com/iduhetonas/9318958
>
> Could anybody shed some light on what I'm seeing?
>
>
> Regards,
> Tyler Huffman
>
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
It does element-wise comparisons and in case one of the lists is empty,
the other one is considered greater (unless they are both empty).
So:
Prelude> max [1] [2]
Here 2 is bigger than 1 so we get the result straight away
Prelude> max [1,2] [1]
Here the first element is equal so we compare the rest of lists: [2] and
[]. As the second list is empty, we return the first list.
Prelude> max [2,1] [1]
No problem at all here, 2 is greater than 1 so we just return the first
list on the first comparison.
Prelude> max [1,2] [1,2,4]
This is exactly the same case as ?max [1, 2] [1]?: we first compare the
1s, find they are equal and compare the rest of the list. Same with 2s.
Then the base case is ?max [] [4]? so the second list is treated as greater.
Prelude> max [1,2,4] [1,2]
Same as above but with arguments switched. I believe that the law here
is ?max x y ? max y x?.
Prelude> max [[1,2,3],[2,3,4]] [[1,2],[2,3],[2,4]]
This is just like all our other examples except one more level of
nesting. We first end up comparing the first elements of the argument
(so we call out ?max [1, 2, 3] [1, 2]?, and then check each element of
these lists. 1 and 2 are equal and we reach the ?max [3] []? case: the
first list was greater so our whole call returns ?[[1, 2, 3], [2, 3, 4]]?.
I hope that sheds some light.
--
Mateusz K.
------------------------------
Message: 5
Date: Sun, 2 Mar 2014 22:47:13 -0700
From: Tyler Huffman <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Question about Ord for lists and
multi-dimensional lists
Message-ID:
<camyb46bjtag3h7ve0kp+zg01mwqsql8ecoz5vhye6ttmhm9...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Awesome, that helps a lot.
Thanks a bunch, Mateusz!
Regards,
Tyler Huffman
On Sun, Mar 2, 2014 at 10:44 PM, Mateusz Kowalczyk
<[email protected]>wrote:
> On 03/03/14 05:33, Tyler Huffman wrote:
> > Hi all,
> >
> > I'm having trouble finding resources explaining how Ord for two lists
> works.
> >
> > I've created a public gist to explain what I mean.
> >
> > https://gist.github.com/iduhetonas/9318958
> >
> > Could anybody shed some light on what I'm seeing?
> >
> >
> > Regards,
> > Tyler Huffman
> >
> >
> >
> > _______________________________________________
> > Beginners mailing list
> > [email protected]
> > http://www.haskell.org/mailman/listinfo/beginners
> >
>
> It does element-wise comparisons and in case one of the lists is empty,
> the other one is considered greater (unless they are both empty).
>
> So:
> Prelude> max [1] [2]
>
> Here 2 is bigger than 1 so we get the result straight away
>
> Prelude> max [1,2] [1]
>
> Here the first element is equal so we compare the rest of lists: [2] and
> []. As the second list is empty, we return the first list.
>
> Prelude> max [2,1] [1]
>
> No problem at all here, 2 is greater than 1 so we just return the first
> list on the first comparison.
>
> Prelude> max [1,2] [1,2,4]
>
> This is exactly the same case as ?max [1, 2] [1]?: we first compare the
> 1s, find they are equal and compare the rest of the list. Same with 2s.
> Then the base case is ?max [] [4]? so the second list is treated as
> greater.
>
> Prelude> max [1,2,4] [1,2]
>
> Same as above but with arguments switched. I believe that the law here
> is ?max x y ? max y x?.
>
> Prelude> max [[1,2,3],[2,3,4]] [[1,2],[2,3],[2,4]]
>
> This is just like all our other examples except one more level of
> nesting. We first end up comparing the first elements of the argument
> (so we call out ?max [1, 2, 3] [1, 2]?, and then check each element of
> these lists. 1 and 2 are equal and we reach the ?max [3] []? case: the
> first list was greater so our whole call returns ?[[1, 2, 3], [2, 3, 4]]?.
>
> I hope that sheds some light.
>
> --
> Mateusz K.
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140302/19d29fd2/attachment-0001.html>
------------------------------
Message: 6
Date: Mon, 03 Mar 2014 07:51:06 +0100
From: Roelof Wobben <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] foldr problem
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140303/f2e53e4e/attachment.html>
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 69, Issue 6
****************************************