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:  Long time no Haskell....simple typeclass     question
      (Nicholls, Mark)
   2. Re:  Long time no Haskell....simple       typeclass       question
      (Nicholls, Mark)


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

Message: 1
Date: Wed, 31 Dec 2014 11:15:29 +0000
From: "Nicholls, Mark" <[email protected]>
To: "[email protected]" <[email protected]>
Subject: Re: [Haskell-beginners] Long time no Haskell....simple
        typeclass       question
Message-ID:
        
<e7e7fdf32472ff48bb0e4d9dc4283d0e83849...@mtvne-exmb02.mtvne.ad.viacom.com>
        
Content-Type: text/plain; charset="us-ascii"

This is the basic problem...

I have a data type, that has some functions that require typeclass constraints 
(this example doesn't...but that's not the point).

I have a typeclass, and I want to declare my datatype inhabits that type 
class....

> data Func a b = Func (a->b)

> exeFunc :: (Ord a) => Func a b -> a -> b
> exeFunc (Func g) = g

> class IFunc f where
>   exe :: f a b -> a -> b

> instance IFunc Func where
>   exe = exeFunc

Follow your nose and obviously

"No instance for (Ord a) arising from a use of 'exeFunc'"

But how do I constain "a" in the instance declaration, when "a" doesn't even 
appear

CONFIDENTIALITY NOTICE

This e-mail (and any attached files) is confidential and protected by copyright 
(and other intellectual property rights). If you are not the intended recipient 
please e-mail the sender and then delete the email and any attached files 
immediately. Any further use or dissemination is prohibited.

While MTV Networks Europe has taken steps to ensure that this email and any 
attachments are virus free, it is your responsibility to ensure that this 
message and any attachments are virus free and do not affect your systems / 
data.

Communicating by email is not 100% secure and carries risks such as delay, data 
corruption, non-delivery, wrongful interception and unauthorised amendment. If 
you communicate with us by e-mail, you acknowledge and assume these risks, and 
you agree to take appropriate measures to minimise these risks when e-mailing 
us.

MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon 
Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be 
Viacom, Viacom International Media Networks and VIMN and Comedy Central are all 
trading names of MTV Networks Europe.  MTV Networks Europe is a partnership 
between MTV Networks Europe Inc. and Viacom Networks Europe Inc.  Address for 
service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20141231/d7fd95d0/attachment-0001.html>

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

Message: 2
Date: Wed, 31 Dec 2014 11:21:09 +0000
From: "Nicholls, Mark" <[email protected]>
To: "The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell" <[email protected]>
Subject: Re: [Haskell-beginners] Long time no Haskell....simple
        typeclass       question
Message-ID:
        
<e7e7fdf32472ff48bb0e4d9dc4283d0e83849...@mtvne-exmb02.mtvne.ad.viacom.com>
        
Content-Type: text/plain; charset="us-ascii"

I can obviously follow Haskell's advice and go...

> class IFunc f where
>   exe :: (Ord a) => f a b -> a -> b

But that's not really what I want to say...that's constraining the class to 
make it clear that the type inhabits it...not constraining the instance.


CONFIDENTIALITY NOTICE

This e-mail (and any attached files) is confidential and protected by copyright 
(and other intellectual property rights). If you are not the intended recipient 
please e-mail the sender and then delete the email and any attached files 
immediately. Any further use or dissemination is prohibited.

While MTV Networks Europe has taken steps to ensure that this email and any 
attachments are virus free, it is your responsibility to ensure that this 
message and any attachments are virus free and do not affect your systems / 
data.

Communicating by email is not 100% secure and carries risks such as delay, data 
corruption, non-delivery, wrongful interception and unauthorised amendment. If 
you communicate with us by e-mail, you acknowledge and assume these risks, and 
you agree to take appropriate measures to minimise these risks when e-mailing 
us.

MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon 
Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be 
Viacom, Viacom International Media Networks and VIMN and Comedy Central are all 
trading names of MTV Networks Europe.  MTV Networks Europe is a partnership 
between MTV Networks Europe Inc. and Viacom Networks Europe Inc.  Address for 
service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20141231/a9e1913e/attachment-0001.html>

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

Subject: Digest Footer

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


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

End of Beginners Digest, Vol 78, Issue 27
*****************************************

Reply via email to