<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle">P {
        MARGIN-BOTTOM: 0px; MARGIN-TOP: 0px
}
</style>
</head>
<body fPStyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">
<p>ugly...but effective.</p>
<p> </p>
<p>thanks</p>
<p> </p>
<p> </p>
<div style="FONT-SIZE: 16px; FONT-FAMILY: Times New Roman; COLOR: #000000">
<hr tabindex="-1">
<div id="divRpF33800" style="DIRECTION: ltr"><font color="#000000" size="2" face="Tahoma"><b>From:</b> adam vogt [vogt.adam@gmail.com]<br>
<b>Sent:</b> 20 June 2015 16:34<br>
<b>To:</b> Richard Eisenberg<br>
<b>Cc:</b> haskell-cafe; Nicholls, Mark<br>
<b>Subject:</b> Re: [Haskell-cafe] Mild confusion around type family<br>
</font><br>
</div>
<div></div>
<div>
<p dir="ltr"><br>
On Jun 19, 2015 2:29 PM, "Richard Eisenberg" <<a href="mailto:eir@cis.upenn.edu" target="_blank">eir@cis.upenn.edu</a>> wrote:<br>
> With a closed family, you could always do something like this:<br>
><br>
> > type family Error (msg :: Symbol)     -- no instances!<br>
> > type family Sub a b where<br>
> >   -- real work<br>
> >   Sub a b = Error "Sub is undefined here"<br>
><br>
> Would that help? It still doesn't immediately error (there's no way to do that currently), but it's perhaps more telling to have an error string.</p>
<p dir="ltr">Ghc does error out right away if you give it an infinite loop:</p>
<p dir="ltr">type family Fail (x::k) (a :: *) where<br>
  Fail x a = Fail x (Fail "don't raise the context stack please" a)</p>
<p dir="ltr">-- defining f leads to compile failure, and the message includes the "msg"<br>
f :: Fail "msg" ()<br>
f = undefined</p>
<p dir="ltr">But it would be nice to have a less hacky solution, especially as this one gives error messages that suggest giving the type checker more resources.</p>
<p dir="ltr">Regards,<br>
Adam<br>
</p>
</div>
</div>
</div>
<P></P>
<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>