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:  Trouble Understanding How to Start (David McBride)
   2.  Functors and Applicatives;       I'm just not getting it ... (Frank)
   3. Re:  Functors and Applicatives; I'm just not getting it ...
      (Adam Flott)
   4. Re:  latest Haskell Platform build fails (Heinrich Apfelmus)
   5. Re:  Functors and Applicatives;   I'm just not getting it ...
      (Karl Voelker)
   6. Re:  Functors and Applicatives; I'm just not getting it ...
      (Benjamin Edwards)


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

Message: 1
Date: Sat, 18 Oct 2014 15:32:47 -0400
From: David McBride <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Trouble Understanding How to Start
Message-ID:
        <can+tr43cmgksa4hxpguhau5dxzqqnavkqf+e1k3o-8fb7e+...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

It might help you to remember that you can sort of replace the types in a
function with their equivalents, and it may lead you to realizing how to do
them.

For example:

get :: Name -> Env -> Int
is equivalent to
get :: String -> (String -> Maybe Int) -> Int

So think about how you can take the string you have, put it into that
function that takes a string and gives a maybe int, then how to get the int
out of the maybe int.  You'll get it.

On Sat, Oct 18, 2014 at 11:08 AM, Keeley Abbott <[email protected]>
wrote:

> Hi All,
>
> So, I am taking a Functional Programming class this fall, and I have
> struggling to understand how to build types and functions correctly. For
> some reason it just isn?t clicking. I have the following module I am
> working on, and I need some guidance.
>
> ? Variable names
> type Name = String
>
> ? An environment for looking up the value of a variable
> type Env = Name -> Maybe Int
>
> ? An empty environment
> empty :: Env
> empty env = Nothing
>
> ? Set a variable to a value in the environment if it doesn?t already exist
> set :: Name -> Int -> Env -> Env
> set x i e = \y -> if x == y then (Just i) else e y
>
> ? Lookup the value of a variable in the environment
> get :: Name -> Env -> Int
> get x env = ?? (I previously had ?type Env = Name -> Int?, so this was
> working with env x, but we had to change empty to be something other than
> just a runtime error, which is why I made Env = Name -> Maybe Int)
>
> ?Remove a variable from the environment
> unset :: Name -> Env -> Env
> unset x e = \y -> if x == y then empty x else env y
>
> At this point I don?t know how to fix get, so I get an int to display (it
> keeps telling me it can?t match the type ?Maybe Int? with the expected type
> ?Int?). And I don?t know where to go from there to create getOr, setAll,
> and mapEnv functions, because I am just not understanding what I am doing.
> For the most part I have been doing simpler things that I could just mess
> with the functions until they work, but even at that I?m not getting HOW
> they work? Any assistance or instruction on how I can GET what I am trying
> to do would be greatly appreciated.
>
> Thanks,
> Kallarhynn
> _______________________________________________
> 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/20141018/cb435026/attachment-0001.html>

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

Message: 2
Date: Sat, 18 Oct 2014 18:37:18 -0400
From: Frank <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: [Haskell-beginners] Functors and Applicatives; I'm just not
        getting it ...
Message-ID:
        <ca+a3wklxtifmqhhvsxens8noq475hp+lslo-hoooxvsnfoc...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

I've had a go at LYAH and CIS 194 and the Typeclassopedia and I just don't
get get functors and applicatives. I'm simply not understanding them, what
the various symbols/keywords mean, what they represent, how to think of
them, etc. Nothing. Is there any kind of documented model I should be
considering? Is there a "functors and applicatives for Dummies" I should
read? Should I just give it up, not bother with Haskell and just stick to
scheme/ruby/C++?

-- 
P.S.: I prefer to be reached on BitMessage at
BM-2D8txNiU7b84d2tgqvJQdgBog6A69oDAx6
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20141018/4aaf8b79/attachment-0001.html>

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

Message: 3
Date: Sat, 18 Oct 2014 18:45:53 -0400
From: Adam Flott <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Functors and Applicatives; I'm just
        not getting it ...
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"

On Sat, 18 Oct 2014 18:37:18 -0400
Frank <[email protected]> wrote:

> Is there a "functors and applicatives for Dummies" I should
> read? Should I just give it up, not bother with Haskell and just stick to
> scheme/ruby/C++?
> 

Give this visual tutorial a whirl,

http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_pictures.html

And then play around with 
http://hackage.haskell.org/package/optparse-applicative

Those 2 resources helped reinforce my understanding.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20141018/316a2eee/attachment-0001.sig>

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

Message: 4
Date: Sun, 19 Oct 2014 09:55:38 +0200
From: Heinrich Apfelmus <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] latest Haskell Platform build fails
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8; format=flowed

Mateusz Kowalczyk wrote:
> On 10/18/2014 01:16 PM, Michael Martin wrote:
>> 
>> I find it astonishing that build/install fails because it finds
>> that a dependency that it needs is already installed. This is
>> totally unreasonable. I was really looking forward to experimenting
>> with Cloud Haskell, but the pain of installation, coupled with
>> Haskell's well-known issues with "dependency hell", have soured me
>> on Haskell. The language itself is amazing - I really like it. But
>> I'm afraid that the dysfunctional nature of the Haskell ecosystem
>> is driving me back to Erlang/OTP. OTP has proven to be industrial 
>> strength. I hope that someday (soon), Haskell will be able to claim
>>  that, as well.
>> 
> 
> Why don't you use [1] instead of getting the source binary and
> finding yourself struggling? It comes with GHC.
> 
> [1]: http://www.haskell.org/platform/linux.html#binary

Indeed. Michael, don't make this harder on yourself than it needs to be. 
I know, you're using Linux, but it's just easier to download the binary 
and run the installer. Trying to compile source code in an ecosystem 
that you are not familiar with yet is likely to give you headaches. The 
download site for GHC explicitly says "Stop! For most users, we 
recommend installing the Haskell Platform instead of GHC" in big red 
letters.

Also, Michael, you don't actually have to install the platform. You 
*already have* a working Haskell environment, as you managed to install 
GHC and cabal just fine. Besides the packaging, the Haskell platform 
just contains some useful packages, which you can easily install after 
the fact via cabal.


Best regards,
Heinrich Apfelmus

--
http://apfelmus.nfshost.com



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

Message: 5
Date: Sun, 19 Oct 2014 01:20:07 -0700
From: Karl Voelker <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Functors and Applicatives;     I'm just
        not getting it ...
Message-ID: <[email protected]>
Content-Type: text/plain;       charset=us-ascii

I suggest that you ignore applicatives for now and just focus on plain-old 
functors. They are the simplest part, and once you are confident in dealing 
with them, adding on applicatives will be much easier.

And, although it can be difficult when you are really lost, if you can ask some 
more specific questions, this list will provide plenty of answers.

-Karl

> On Oct 18, 2014, at 3:37 PM, Frank <[email protected]> wrote:
> 
> I've had a go at LYAH and CIS 194 and the Typeclassopedia and I just don't 
> get get functors and applicatives. I'm simply not understanding them, what 
> the various symbols/keywords mean, what they represent, how to think of them, 
> etc. Nothing. Is there any kind of documented model I should be considering? 
> Is there a "functors and applicatives for Dummies" I should read? Should I 
> just give it up, not bother with Haskell and just stick to scheme/ruby/C++?
> 
> -- 
> P.S.: I prefer to be reached on BitMessage at 
> BM-2D8txNiU7b84d2tgqvJQdgBog6A69oDAx6
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners


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

Message: 6
Date: Sun, 19 Oct 2014 01:46:46 -0700 (PDT)
From: "Benjamin Edwards" <[email protected]>
To: "The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell" <[email protected]>
Cc: "The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell" <[email protected]>
Subject: Re: [Haskell-beginners] Functors and Applicatives; I'm just
        not getting it ...
Message-ID: <1413708406546.e64bc258@Nodemailer>
Content-Type: text/plain; charset="utf-8"

The only thing I feel to recommend given the generality of the question is to 
say: Pick some concrete instances of Functor, and play with them. Write a 
program with a failing component using 'Maybe' then see how much you can get 
done without pattern matching. Write a program over some lists and use fmap 
instead of map. Realise there isn't much more to fmap than a very general 
signature and some laws. See what the laws mean for the two concrete instances 
that you just used. Be satisfied. When you get a little further on your journey 
and see more interesting examples of the class you will see how useful it is. 
For instance most parser interfaces admit a functor instance. Which means that 
say you had a language with variable identifiers with a leading '$' sign 
followed by a string, writing a parser is super simple.  Assume 'stringVar' is 
a 'Parser String' that parsers an identifier and 'Var' is a new type on strings 
for wrapping identifiers then Var `fmap` stringVar is a 'Parser Var'. I
  could offer again that a functor is nothing more than a principled way to 
change the 'generic type' of things that look like containers of type Foo<T>, 
not sure if that is helpful, given your previous reading list.

I hope this offers some insight. Haskell, like any learning endeavour requires 
you to just mess about with it until things start to click. You will miss out 
on a very rich learning experience if you cast it aside. Good luck!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20141019/a73a171d/attachment.html>

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

Subject: Digest Footer

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


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

End of Beginners Digest, Vol 76, Issue 13
*****************************************

Reply via email to