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. Re:  Print values stored in an "Either" in the main method
      (Brandon Allbery)
   2. Re:  Print values stored in an "Either" in the main method
      (Mathew Phillips)
   3. Re:  Print values stored in an "Either" in the main method
      (Brandon Allbery)
   4.  Type Class Instance Question (Philippe Sismondi)
   5. Re:  Type Class Instance Question (Michael Orlitzky)
   6. Re:  Type Class Instance Question (Philippe Sismondi)
   7. Re:  Need help with HXT (Vlatko Basic)


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

Message: 1
Date: Thu, 20 Feb 2014 20:10:18 -0500
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] Print values stored in an "Either" in
        the main method
Message-ID:
        <cakfcl4x5wnb6gxt1am-gfqruhovkkimnwgcaa2ny_2cxfyo...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

On Thu, Feb 20, 2014 at 8:05 PM, Mathew Phillips
<[email protected]>wrote:

> Ok now I'm even more confused! That works, but I thought that "let" was
> for when the value inside the do block was pure, and the <- notation when
> it's inside another monad?
>

Are you referring to the fact that Either has a Monad instance? Because
you're not *using* it monadically, but purely, so its Monad instance is not
relevant. Likewise lists have a Monad instance, but most of the time you
don't use it, you treat them as pure values.

(You also can't mix monads; if you're using <- in a do block in IO, it must
be working with a value in IO, not merely one in some monad. This is
clearer when you learn how do blocks desugar into functions.)

-- 
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://www.haskell.org/pipermail/beginners/attachments/20140220/4448b566/attachment-0001.html>

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

Message: 2
Date: Thu, 20 Feb 2014 19:16:27 -0600
From: Mathew Phillips <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Print values stored in an "Either" in
        the main method
Message-ID:
        <cahukxc++tmoaqm1xy73nifevwwffcrp89o_rmhw2iy8ot5o...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Actually your comment in parenthesis is what made it click. If i do "result
<- return $ runEval ..." it works too. The fact that the first error was
complaining that it expected something of type IO should have tipped me
off.

Thank you,
Matt P.


On Thu, Feb 20, 2014 at 7:10 PM, Brandon Allbery <[email protected]>wrote:

> On Thu, Feb 20, 2014 at 8:05 PM, Mathew Phillips <
> [email protected]> wrote:
>
>> Ok now I'm even more confused! That works, but I thought that "let" was
>> for when the value inside the do block was pure, and the <- notation when
>> it's inside another monad?
>>
>
> Are you referring to the fact that Either has a Monad instance? Because
> you're not *using* it monadically, but purely, so its Monad instance is not
> relevant. Likewise lists have a Monad instance, but most of the time you
> don't use it, you treat them as pure values.
>
> (You also can't mix monads; if you're using <- in a do block in IO, it
> must be working with a value in IO, not merely one in some monad. This is
> clearer when you learn how do blocks desugar into functions.)
>
> --
> brandon s allbery kf8nh                               sine nomine
> associates
> [email protected]
> [email protected]
> unix, openafs, kerberos, infrastructure, xmonad
> http://sinenomine.net
>
> _______________________________________________
> 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/20140220/56e59a81/attachment-0001.html>

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

Message: 3
Date: Thu, 20 Feb 2014 20:32:32 -0500
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] Print values stored in an "Either" in
        the main method
Message-ID:
        <cakfcl4xogjtwwrqc433efap9gru86r5jofgl7+8qe8vn7_i...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

On Thu, Feb 20, 2014 at 8:16 PM, Mathew Phillips
<[email protected]>wrote:

> Actually your comment in parenthesis is what made it click. If i do
> "result <- return $ runEval ..." it works too. The fact that the first
> error was complaining that it expected something of type IO should have
> tipped me off.
>

Note also that, while using <- that way "should" have the same effect as
using let, it forces the value to be sequenced with I/O actions, which you
may not want. It may disable optimizations, for one thing, and changes
laziness since it is now constrained by sequencing with I/O when I/O isn't
actually involved with it.

-- 
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://www.haskell.org/pipermail/beginners/attachments/20140220/0640a633/attachment-0001.html>

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

Message: 4
Date: Thu, 20 Feb 2014 23:48:55 -0500
From: Philippe Sismondi <[email protected]>
To: The to Haskell Haskell-Beginners Mailing List - Discussion of
        primarily beginner-level topics related <[email protected]>
Subject: [Haskell-beginners] Type Class Instance Question
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"

In the Haskell 98 and 2010 reports it states that one may declare something of 
the form (tyvar1 -> tyvar2) to be an instance of a type class. Is that a 
function or what is it? Can anyone point me to an example of this?

TIA.

Best,

- Phil -
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20140220/9bcb2b54/attachment-0001.html>

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

Message: 5
Date: Fri, 21 Feb 2014 00:02:10 -0500
From: Michael Orlitzky <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] Type Class Instance Question
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1

On 02/20/2014 11:48 PM, Philippe Sismondi wrote:
> In the Haskell 98 and 2010 reports it states that one may declare
> something of the form /(tyvar1 -> tyvar2)/ to be an instance of a type
> class. Is that a function or what is it? Can anyone point me to an
> example of this?

It refers to something like (a -> b) which is the type of functions from
'a' to 'b' (tyvar1 and tyvar2 in the report). Here's a
not-terribly-useful example of such an instance:

  instance Show (a -> b) where
    show f = "some kinda function"

  main = print foldl

A better example could make those functions an instance of Num, so that
you could write f + g to represent f(x) + g(x), f * g for f(x) * g(x),
and so on.




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

Message: 6
Date: Fri, 21 Feb 2014 00:39:21 -0500
From: Philippe Sismondi <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Type Class Instance Question
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii

Oh, cool, thanks. That clears it up.

I mean, I knew of course that "a -> b" means a function from type a to type b. 
What I was forgetting is that (->) is a type constructor of kind *->*->*, so an 
instance declaration could consistently treat (a -> b) as a concrete type like 
any other.

My thinking is still often contaminated with my pre-Haskell intuitions 
sometimes. I sometimes revert to thinking of data and functions as being from 
two different universes. I wonder if I'll ever get over that, or of being a 
perpetual FP noob. Sigh.

Thanks again.

- Phil -


On 2014-02-21, at 12:02 AM, Michael Orlitzky <[email protected]> wrote:

> On 02/20/2014 11:48 PM, Philippe Sismondi wrote:
>> In the Haskell 98 and 2010 reports it states that one may declare
>> something of the form /(tyvar1 -> tyvar2)/ to be an instance of a type
>> class. Is that a function or what is it? Can anyone point me to an
>> example of this?
> 
> It refers to something like (a -> b) which is the type of functions from
> 'a' to 'b' (tyvar1 and tyvar2 in the report). Here's a
> not-terribly-useful example of such an instance:
> 
>  instance Show (a -> b) where
>    show f = "some kinda function"
> 
>  main = print foldl
> 
> A better example could make those functions an instance of Num, so that
> you could write f + g to represent f(x) + g(x), f * g for f(x) * g(x),
> and so on.
> 
> 
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners



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

Message: 7
Date: Fri, 21 Feb 2014 06:43:57 +0100
From: Vlatko Basic <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Need help with HXT
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hi Philippe,

Have you taken a look at [1]

That's what actually gets called from [2]


[1]: http://hackage.haskell.org/package/curl-1.3.8/docs/Network-Curl.html
[2]: 
http://hackage.haskell.org/package/hxt-curl-9.1.1/docs/src/Text-XML-HXT-Arrow-LibCurlInput.html#withCurl

Best regards,

vlatko



-------- Original Message  --------
Subject: Re: [Haskell-beginners] Need help with HXT
From: Philippe Sismondi <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level 
topics related to Haskell <[email protected]>
Date: 20.02.2014 22:48

>
> On 2014-02-20, at 1:49 PM, Michael Orlitzky <[email protected]> wrote:
>
>> On 02/16/2014 09:34 AM, Philippe Sismondi wrote:
>>
>> I can't be sure, but the 'Attributes' type is a list of 2-tuples that
>> contain... something. I would try the empty list and see what happens.
>> For example,
>>
> Thanks, Michael. I can get withCurl to work when I supple an empty list, but 
> I am guessing that the curl options allow more control. There is a link that 
> purports to document curl and http options, but the links are broken. I 
> contacted Uwe Schmidt (a prof who spearheaded development of HXT, I think). 
> He replied to say that he would check into it when he has time.
>
> I may have to plunge into the source code to see how curl and/or http 
> actually get called if nobody restores the broken links.
>
> Meanwhile thanks for the reply.
>
> - P -
>
>>   readDocument [ withCurl [] ] "http://example.com/some.xml";
>>
>> _______________________________________________
>> Beginners mailing list
>> [email protected]
>> http://www.haskell.org/mailman/listinfo/beginners
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>


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

Subject: Digest Footer

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners


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

End of Beginners Digest, Vol 68, Issue 18
*****************************************

Reply via email to