<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body style="background-color: rgb(255, 255, 255); color: rgb(0, 0,
0);" text="#000000" bgcolor="#FFFFFF">
The old Turbo Pascal keyword "with" (used for records) popped up in
my mind. <br>
It's rather clear for namespace resolution and would look something
like this:<br>
<br>
with Data.ByteString $ do<br>
map f ...<br>
<br>
with Prelude $ do<br>
map f ...<br>
<br>
or more explicit<br>
<br>
withImport Data.ByteString $ do<br>
....<br>
<br>
vlatkoB<br>
<br>
<blockquote style="border-left: 2px solid #330033 !important;
border-right: 2px solid #330033 !important; padding: 0px 15px 0px
15px; margin: 8px 2px;"
cite="mid:CAGRp5Rk36iPKhz3NX9HaUOP-1tQibrEk2J3tXz6KmKZOesq2uA@mail.gmail.com"
type="cite"><!--[if !IE]><DIV style="border-left: 2px solid #330033; border-right: 2px solid #330033; padding: 0px 15px; margin: 2px 0px;"><![endif]--><span
style="color:#000000;" class="headerSpan">
<div class="moz-cite-prefix">-------- Original Message --------<br>
Subject: Re: [Haskell-cafe] Syntax extension - adding import
support to let/where bindings<br>
From: Oliver Charles <a class="moz-txt-link-rfc2396E" href="mailto:ollie@ocharles.org.uk"><ollie@ocharles.org.uk></a><br>
To: Tikhon Jelvis <a class="moz-txt-link-rfc2396E" href="mailto:tikhon@jelv.is"><tikhon@jelv.is></a>, Haskell Cafe
<a class="moz-txt-link-rfc2396E" href="mailto:haskell-cafe@haskell.org"><haskell-cafe@haskell.org></a><br>
Date: 05/08/15 22:24<br>
</div>
<br>
<br>
</span>
<div dir="ltr">
<div class="gmail_quote">
<div dir="ltr">On Wed, Aug 5, 2015 at 7:12 PM Tikhon Jelvis
<<a moz-do-not-send="true" href="mailto:tikhon@jelv.is">tikhon@jelv.is</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div>
<div>
<div>
<div>
<div>If you want a direct experience report, I've
written a fair amount of OCaml which supports
pretty much exactly this feature[1]:<br>
<br>
</div>
let open List in ...<br>
<br>
</div>
They even have a weird concise version of the
syntax:<br>
<br>
</div>
List.(...)<br>
<br>
</div>
This is quite useful in practice, and doesn't seem to
cause any problems. However, OCaml has different norms
around external modules, so it might not translate to
Haskell the same way.<br>
<br>
</div>
<div>In OCaml, every module is automatically imported
qualified. There's no list of import statements at the
top. Importing ("opening") a module is equivalent to an
*unqualified* import in Haskell and happens rarely.
Moreover, it can appear in any part of the file. In
practice this doesn't seem to be a problem, but that
could be because nobody's depending on having all the
imports conveniently declared up-front. Personally, I
think this trade-off is perfectly acceptable: I'd rather
have life be better for programmers and worse for tools
than vice-versa.<br>
<br>
</div>
<div>OCaml also doesn't have typeclasses or the open world
assumption which would lead to confusing behavior one
way or another.<br>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>Thanks for providing another perspective! It's good to
hear other languages are successfully employing this idea. </div>
<div><br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div>With all that in mind, OCaml's feature feels closer
to Elliot's suggestion: it's more about locally
*dequalifying* a module than importing it. Doing just
that also fits better with Haskell's current import and
typeclass system. However, I'm not sure how to design a
local dequalifying statement in a way that's not
confusing. </div>
</div>
</blockquote>
<div><br>
</div>
<div>Indeed, having import stay at the top level to always
bring type class instances in followed by the option of
"opening" an import later is certainly more elegant and less
hacky than what I'm proposing. I think this route will have
to require a new keyword though, but we can establish those
details later. I'm leaning more towards this idea now. Let's
see what others think.<br>
</div>
<div><br>
</div>
<div><i>ocharles</i></div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Haskell-Cafe mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a>
<a class="moz-txt-link-freetext" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a>
</pre>
<!--[if !IE]></DIV><![endif]--></blockquote>
<br>
</body>
</html>