[Haskell-beginners] LYAHFGG, chapter 11 question

Gareth gareth.tpc at gmail.com
Fri Aug 29 15:00:11 UTC 2014


Actually, I remember that that chapter being difficult too, so much so that
I don't think I finished it. It might be worth coming back to that chapter
later, after you have more practical experience.

In the mean time though, if I could tell you only one fact about how to use
Applicative, it would be this.

Say you have some pure function:

f :: Int -> Int -> Int -> Int

And some values that may or may not be in the context of some Applicative
functor (let's say Maybe)

x :: Maybe Int
y :: Int
z :: Maybe Int

Then you can call f like this:

(f <$> x <*> pure y <*> z  ) :: Maybe Int

So if you were in the middle of some do notation you could

do
   myF <- f <$> x <*> pure y <*> z
   ...

rather than the more painful

do
   x' <- x
   z' <- z
   let myF = f x' y z'
   ...







On Wed, Aug 27, 2014 at 10:22 AM, Peter Hall <peterjoel at gmail.com> wrote:

> > I learned a new word today, “Sisyphean.”
>
> Me too! :)
>
>  Peter
>
>
> On 27 August 2014 04:21, Jeff C. Britton <jcb at iteris.com> wrote:
>
>>  I had originally encountered problems at this point myself.  I lost
>> motivation because I had just had this feeling that programming with
>> applicatives was just not going to be fun, and it was beginning to seem
>> like Haskell programming might involve a lot of this.  I put the book down
>> for about 1 year.  Somewhere I came across an article on Monads that
>> changed my mind.  I started over and am now almost done with Chapter 13.
>> This time around things are looking a lot cooler.  I think chapters 11,12,
>> and 13 may lack the motivational information to keep one going.  I can say
>> that the author Miran Lipovaca really does a great job of explaining this
>> material.  I don’t think you are going to find a better source.  Absolutely
>> every step of the way is laid out in painstaking detail.  Plus there are
>> constant reminders of material that was just covered that is relevant to
>> the immediate situation.  All I can say is go slow and make sure you
>> understand every detail before proceeding.  Keep at it regularly so as not
>> to forget important terms.  Go back and reread if necessary.  Have the
>> confidence that it will be worthwhile.  The Monad chapters are little bit
>> more interesting, but you will need to understand the applicatives first.
>> I learned a new word today, “Sisyphean.”
>>
>>
>>
>> *From:* Beginners [mailto:beginners-bounces at haskell.org] *On Behalf Of *
>> Frank
>> *Sent:* Tuesday, August 26, 2014 7:33 PM
>> *To:* The Haskell-Beginners Mailing List - Discussion of primarily
>> beginner-level topics related to Haskell
>> *Subject:* [Haskell-beginners] LYAHFGG, chapter 11 question
>>
>>
>>
>> About "Learn You a Haskell ...", is it My imagination or is chapter 11
>> absurdly long and/or thick? I can (and have) read a 100+ page U.S. Supreme
>> Court ruling, readily understand it, and be able to explain it in plain
>> English, with next to zero trouble. I spend every work day reading,
>> parsing, interpreting, and using, the ISO C++ standard. I *taught* My
>> undergraduate Physics IV class while simultaneously taking it. Yet, chapter
>> 11 feels as if it goes on and on to the point I easily forget what I read
>> just a few lines before, rendering comprehension of the same an almost
>> Sisyphean task. Is it just Me? Am I just tired? Is there an alternative
>> resource for understanding the concepts that particular chapter presents?
>>
>>
>>
>> Sincerely,
>>
>> Frank D. Martinez
>>
>>
>>
>> --
>> P.S.: I prefer to be reached on BitMessage at
>> BM-2D8txNiU7b84d2tgqvJQdgBog6A69oDAx6
>>
>> _______________________________________________
>> Beginners mailing list
>> Beginners at haskell.org
>> http://www.haskell.org/mailman/listinfo/beginners
>>
>>
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20140829/9f84e510/attachment.html>


More information about the Beginners mailing list