<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body dir="auto">
<div>Reading around this more i think the extreme case (of what im interested in) is type arithemetic, ie the set of type "inside" the container is not necessarily finite in general, but yes, i see how you construct works.</div>
<div><br>
</div>
<div>So in think for my specific purposes the associated type route is the first place for me to investigate</div>
<div><br>
Excuse the spelling, sent from a phone with itty bitty keys, it like trying to sow a button on a shirt with a sausage.
<div><br>
</div>
</div>
<div><br>
On 7 Jan 2015, at 20:58, Akash Ganesan <<a href="mailto:akaberto@gmail.com">akaberto@gmail.com</a>> wrote:<br>
<br>
</div>
<blockquote type="cite">
<div>
<div dir="ltr">If I understand the issue at hand, you want the container, which is<br>
basically  a collection of types to be closed under our<br>
operation.  Since we are dealing with set of different typed objects,<br>
which is to be closed under a given operation, why not create a new type<br>
that captures the essence of the set (ie., a new data type)? Something<br>
like the following.<br>
<br>
data S = SInt Int<br>
       | SChar Char<br>
       | STuple (Char, Char) deriving (Show, Eq)<br>
<br>
class MyFoo a where<br>
    op :: a -> a<br>
<br>
And the instance goes something like this.<br>
<br>
instance MyFoo S where<br>
    op (SInt x)        = SInt $ toEnum x<br>
    op (SChar x)    = STuple (x,x)<br>
    op (STuple (x,y))    = SInt $ fromEnum x<br>
<br>
<br>
<br>
On Tuesday, 6 January 2015 23:13:59 UTC+5:30, Nicholls, Mark wrote:
<blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">
<div link="blue" vlink="purple" lang="EN-GB">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">This is reposted from the beginnners….I’ve not done Haskell for a while and was struggling to get anything to work, I’ve hopefully refound my feet.</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span></p>
<p class="MsoNormal">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</p>
<p class="MsoNormal" style="margin-left:36.0pt"> </p>
<p class="MsoNormal">I have a suggestion that does work</p>
<p class="MsoNormal" style="margin-left:36.0pt"> </p>
<p class="MsoNormal">class Foo m where</p>
<p class="MsoNormal" style="text-indent:36.0pt">op :: m a -> m (S a)</p>
<p class="MsoNormal" style="margin-left:36.0pt"> </p>
<p class="MsoNormal">That is closed, but now were working on types of kind • -> •</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">(S can be a type family or a data type…lets say it’s a type family….probably an associated type (if I know what that means))</p>
<p class="MsoNormal" style="margin-left:36.0pt"> </p>
<p class="MsoNormal">Is this the idiom/pattern i should follow? Or can the closure contraint be expressed directly in a typeclass any other way?</p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"" lang="EN-US">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"" lang="EN-US"> Haskell-Cafe [mailto:<a href="javascript:" target="_blank" gdf-obfuscated-mailto="F2JD1qPceWgJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">haskell-ca...@<wbr>haskell.org</a>]
<b>On Behalf Of </b>Brandon Allbery<br>
<b>Sent:</b> 06 January 2015 1:59 PM<br>
<b>To:</b> Rob Leslie<br>
<b>Cc:</b> Haskell Cafe<br>
<b>Subject:</b> Re: [Haskell-cafe] Haskeline and asynchronous messages</span></p>
<p class="MsoNormal" style="margin-left:36.0pt"> </p>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-left:36.0pt">On Tue, Jan 6, 2015 at 3:27 AM, Rob Leslie <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="F2JD1qPceWgJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">r...@mars.org</a>>
 wrote:</p>
<p class="MsoNormal" style="margin-left:36.0pt">Does anyone have a suggestion on using Haskeline in an environment where another thread may be writing messages to the terminal -- is it possible to somehow print incoming messages above the input line without
 disturbing the input line?</p>
<div>
<p class="MsoNormal" style="margin-left:36.0pt"> </p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36.0pt">Terminals don't really work that way; you need to be looking at something like curses or vty. </p>
</div>
</div>
<div>
<p class="MsoNormal" style="margin-left:36.0pt"> </p>
</div>
<p class="MsoNormal" style="margin-left:36.0pt">-- </p>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-left:36.0pt">brandon s allbery kf8nh                               sine nomine associates</p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36.0pt"><a href="javascript:" target="_blank" gdf-obfuscated-mailto="F2JD1qPceWgJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">allb...@gmail.com</a>              
                    <a href="javascript:" target="_blank" gdf-obfuscated-mailto="F2JD1qPceWgJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">ball...@sinenomine.net</a></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36.0pt">unix, openafs, kerberos, infrastructure, xmonad        <a href="http://sinenomine.net" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fsinenomine.net\46sa\75D\46sntz\0751\46usg\75AFQjCNHBnww-LlA19Cq0MQZiTCtVEC-wow';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fsinenomine.net\46sa\75D\46sntz\0751\46usg\75AFQjCNHBnww-LlA19Cq0MQZiTCtVEC-wow';return true;">http://sinenomine.net</a></p>
</div>
</div>
</div>
</div>
</div>
</div>
<p><br>
<br>
CONFIDENTIALITY NOTICE<br>
<br>
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.<br>
<br>
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.<br>
<br>
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.<br>
<br>
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.</p>
</div>
</blockquote>
</div>
</div>
</blockquote>
<P><br><br>CONFIDENTIALITY NOTICE<br><br>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.<br><br>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.<br><br>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.<br><br>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.<br></P></body>
</html>