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. Re:  Monad for Pair (Mike Houghton)
   2. Re:  Monad for Pair (Mike Houghton)
   3.  Functional Programming for the Object Oriented (?ystein Kolsrud)
   4.  Applicative Laws for the ((->) r) type (Umair Saeed)
   5.  Learning Haskell: Higher-order Functions (Manuel M T Chakravarty)
   6. Re:  Monad for Pair (Kim-Ee Yeoh)


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

Message: 1
Date: Wed, 18 Nov 2015 18:33:35 +0000
From: Mike Houghton <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Monad for Pair
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"

'Much better if you let us know the source of this problem. Is this an exercise 
from some book / online course??

The source is just me exploring. 
I first looked at 

data C a = C a deriving (Show)

and made Monad, Applicative, Monoid and Functors for it.

So then tried 
Pair a = P (a, a)  
and stuck on Monad.

Thanks  

Mike

> On 18 Nov 2015, at 07:23, Kim-Ee Yeoh <[email protected] 
> <mailto:[email protected]>> wrote:
> 
> 
> On Wed, Nov 18, 2015 at 4:41 AM, Mike Houghton <[email protected] 
> <mailto:[email protected]>> wrote:
> 
> And really return x  = P (x, x) doesn?t seem correct anyway.
> 
> But if you look at the type, which is essentially "a -> (a,a)" there's only 
> one way to write it, for the same reason that there's only one "a -> a" 
> function.
> 
> Would someone please write the Monad with an explanation?
> 
> Much better if you let us know the source of this problem. Is this an 
> exercise from some book / online course?
> 
> -- Kim-Ee
> _______________________________________________
> Beginners mailing list
> [email protected] <mailto:[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/20151118/88a6c0be/attachment-0001.html>

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

Message: 2
Date: Wed, 18 Nov 2015 18:33:59 +0000
From: Mike Houghton <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Monad for Pair
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"

'Much better if you let us know the source of this problem. Is this an exercise 
from some book / online course??

The source is just me exploring. 
I first looked at 

data C a = C a deriving (Show)

and made Monad, Applicative, Monoid and Functors for it.

So then tried 
Pair a = P (a, a)  
and stuck on Monad.

Thanks  

Mike

> On 18 Nov 2015, at 07:23, Kim-Ee Yeoh <[email protected] 
> <mailto:[email protected]>> wrote:
> 
> 
> On Wed, Nov 18, 2015 at 4:41 AM, Mike Houghton <[email protected] 
> <mailto:[email protected]>> wrote:
> 
> And really return x  = P (x, x) doesn?t seem correct anyway.
> 
> But if you look at the type, which is essentially "a -> (a,a)" there's only 
> one way to write it, for the same reason that there's only one "a -> a" 
> function.
> 
> Would someone please write the Monad with an explanation?
> 
> Much better if you let us know the source of this problem. Is this an 
> exercise from some book / online course?
> 
> -- Kim-Ee
> _______________________________________________
> Beginners mailing list
> [email protected] <mailto:[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/20151118/9b346e6a/attachment-0001.html>

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

Message: 3
Date: Wed, 18 Nov 2015 20:35:42 +0100
From: ?ystein Kolsrud <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] Functional Programming for the Object
        Oriented
Message-ID:
        <CAH_oh=wOZaqkSJvZ4ap3chsWHfm3aAsft4=zgdkk4fsddla...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

I gave a presentation on functional programming a couple of weeks ago
that I thought might be of interest to this community as well:

https://www.youtube.com/watch?v=I2tMmsZC1ZU

It's target audience is programmers familiar with object oriented
programming, and it presents how concepts from the functional paradigm
are relevant also in most modern OO languages.

For more information about the presentation, please refer to the following site:

http://www.foocafe.org/previous_event/functional-programming-for-the-object-oriented

-- 
Mvh ?ystein Kolsrud


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

Message: 4
Date: Wed, 18 Nov 2015 17:03:50 -0800
From: Umair Saeed <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] Applicative Laws for the ((->) r) type
Message-ID:
        <cad2rvxao7jsrdiofdsm9s3rhxps9vc_0+qrl312hwzkammt...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Hi all,

I'm trying to check that the Applicative laws hold for the function type ((->)
r), and here's what I have so far:

-- Identiy
pure (id) <*> v = v
pure (id) <*> v
const id <*> v
(\x -> const id x (g x))
(\x -> id (g x))
(\x -> g x)
g x
v


-- Homomorphism
pure f <*> pure x = pure (f x)
pure f <*> pure x
const f <*> const x
(\y -> const f y (const x y))
(\y -> f (x))
(\_ -> f x)
pure (f x)


Did I perform the steps for the first two laws correctly?

I'm struggling with the interchange & composition laws. For interchange, so
far I have the following:

-- Interchange
u <*> pure y = pure ($y) <*> u
u <*> pure y
u <*> const y
(\x -> g x (const y x))
(\x -> g x y)
-- I'm not sure how to proceed beyond this point.


I would appreciate any help for the steps to verify the Interchange &
Composition applicative laws for the ((->) r) type.

Thank you,
~Umair
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20151118/1624910e/attachment-0001.html>

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

Message: 5
Date: Thu, 19 Nov 2015 14:26:31 +1100
From: Manuel M T Chakravarty <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] Learning Haskell: Higher-order Functions
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8

We have got a new tutorial chapter on ?Higher-order Functions & Combinators?:

  http://blog.haskellformac.com/blog/higher-order-functions-combinators

Hope you enjoy it!
Manuel



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

Message: 6
Date: Thu, 19 Nov 2015 13:34:48 +0700
From: Kim-Ee Yeoh <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Monad for Pair
Message-ID:
        <CAPY+ZdS-RxU9o5bpB70Jt=ot8ul72vj5d9+rrvj9nz4oz5u...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

On Thu, Nov 19, 2015 at 1:33 AM, Mike Houghton <[email protected]>
wrote:

The source is just me exploring.
>

Nice.


> I first looked at
>
> data C a = C a deriving (Show)
>
> and made Monad, Applicative, Monoid and Functors for it.
>

Even though the null-effect instances for the identity functor are trivial,
there's value in writing them out, especially for the motivated.

But how do you take an arbitrary type and turn it into a monoid?

-- Kim-Ee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20151119/efd54cc2/attachment.html>

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

Subject: Digest Footer

_______________________________________________
Beginners mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners


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

End of Beginners Digest, Vol 89, Issue 32
*****************************************

Reply via email to