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: Structural restrictions in type constructor (Imants Cekusins)
2. Re: Structural restrictions in type constructor (Rein Henrichs)
3. Re: Structural restrictions in type constructor (Imants Cekusins)
----------------------------------------------------------------------
Message: 1
Date: Tue, 23 Jun 2015 22:14:52 +0200
From: Imants Cekusins <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Structural restrictions in type
constructor
Message-ID:
<cap1qinyzwohegec7wza6mj+ngynfekguqed-ex48qr23fui...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
> alter its Eq => definition
module MatchTuple (MyP) where
data MyP t = MyP(t,t) deriving Show
instance Eq t => Eq (MyP t) where
(==) = match
match::Eq t => MyP t-> MyP t -> Bool
match (MyP(x1,x2)) (MyP(x3,x4))
| x1 == x3 && x2 == x4 = True
| x1 == x4 && x2 == x3 = True
| otherwise = False
?
------------------------------
Message: 2
Date: Tue, 23 Jun 2015 20:33:55 +0000
From: Rein Henrichs <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Structural restrictions in type
constructor
Message-ID:
<CAJp6G8zJ8Kp5stiLusW-7tP8fmMSsFR8efBwBDV_=trzlzc...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
FYI, Data.Map uses an Ord instance for keys, not an Eq instance.
On Tue, Jun 23, 2015 at 1:15 PM Imants Cekusins <[email protected]> wrote:
> > alter its Eq => definition
>
> module MatchTuple (MyP) where
>
> data MyP t = MyP(t,t) deriving Show
> instance Eq t => Eq (MyP t) where
> (==) = match
>
>
> match::Eq t => MyP t-> MyP t -> Bool
> match (MyP(x1,x2)) (MyP(x3,x4))
> | x1 == x3 && x2 == x4 = True
> | x1 == x4 && x2 == x3 = True
> | otherwise = False
>
>
> ?
> _______________________________________________
> Beginners mailing list
> [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/20150623/5178f9be/attachment-0001.html>
------------------------------
Message: 3
Date: Tue, 23 Jun 2015 22:41:51 +0200
From: Imants Cekusins <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Structural restrictions in type
constructor
Message-ID:
<cap1qinzm6pmqhmn66nmf56rci4pyk+ckfmxcwln0alvsrde...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
> Data.Map uses an Ord instance for keys, not an Eq instance.
Cheers Rein
Ord instance needs to implement compare then also
http://hackage.haskell.org/package/base-4.8.0.0/docs/Data-Ord.html
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 84, Issue 41
*****************************************