[Haskell-cafe] typeclass woes...how to constain a typeclass to be "closed" under an operation....

Nicholls, Mark nicholls.mark at vimn.com
Tue Jan 6 18:53:54 UTC 2015


I will post the question again properly tomorrow but your example indeed is almost a good example, but is trivially closed

If the operation on monoid was

[a]->[b]->[c]

That is also closed; ie [c] is also a monoid.... And the typeclass declaration follows the idiom ive suggested

This only works for types of kind *->*

If i wanted to do this over a type of kind * (ignoring the trivial a->a)

Can i express this in a typeclass?

Please ignore until i resubmit this question

Ps i hate phones

Excuse the spelling, sent from a phone with itty bitty keys, it like trying to sow a button on a shirt with a sausage.


>> On 6 Jan 2015, at 18:10, Tom Ellis <tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk> wrote:
>> 
>> On Tue, Jan 06, 2015 at 05:43:47PM +0000, Nicholls, Mark wrote:
>> Its quite common in maths to have operations in a theory that are (set)
>> closed, i just want to translate that notion to a typeclass
> 
> Do you really need a typeclass (or indeed any way) of doing this?  I suspect
> it will not work.  If you consider the multiplication for the monoid of
> concatenation of lists
> 
>   (++) :: [a] -> [a] -> [a]
> 
> you see that its type already implies that it is "closed".
> 
> Tom
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
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.



More information about the Haskell-Cafe mailing list