<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>A couple syntactic concerns (assuming there's a sane semantics with eg typeclass instances):</div><div><br></div><div> - This seems essentially like name shadowing, which is a source of confusion and therefore bugs (-Wall warns about it)</div><div> - This makes me unable to see what a module imports by looking at the import statements at the top of a file</div><div> - It seems like using "H.width" and "C.width" isn't very costly</div><div><br></div><div>Tom</div><div><br>El Aug 5, 2015, a las 6:28, Oliver Charles <<a href="mailto:ollie@ocharles.org.uk">ollie@ocharles.org.uk</a>> escribió:<br><br></div><blockquote type="cite"><div><div dir="ltr">Hi all,<div><br></div><div>I'm sure this has come up before, but a quick bit of Googling didn't reveal any prior discussions (if you known any, let me know), so I'm kicking off a new discussion.</div><div><br></div><div>I find myself wanting to be able to say something like:</div><div><br></div><div><font face="monospace, monospace">foo = ...</font></div><div><font face="monospace, monospace"> where import Something.Specific</font></div><div><br></div><div>The result would be to import the contents of Something.Specific into the scope of foo and its other where bindings, but not import into the rest of the module that foo is defined in. As a motivating example, I'm currently working on building some HTML in Haskell, and the amount of symbols that come into scope is huge, when you have a DSL for both CSS and HTML - the real pain point being that you get symbols that often conflict.</div><div><br></div><div>Here's an example of something that doesn't type-check currently</div><div><br></div><div><font face="monospace, monospace">image =</font></div><div><font face="monospace, monospace"> img [ width 50, style [ width (px 50) ] ]</font></div><div><br></div><div><font face="monospace, monospace">width</font> here is both a symbol in the HTML DSL and the CSS DSL, but to get this to type check I need to write something like</div><div><br></div><div><div><font face="monospace, monospace">image =</font></div><div><font face="monospace, monospace"> img [ HTML.width 50, style [ CSS.width (CSS.px 50) ] ]</font></div></div><div><br></div><div>That's not particularly bad here, the really pain is repeatedly having to do this for every single symbol I'm using. I'd prefer to be able to write</div><div><br></div><div><font face="monospace, monospace">image = </font></div><div><font face="monospace, monospace"> let css = </font><span style="font-family:monospace,monospace">let import CSS in [ width (px 50) ]</span></div><div><span style="font-family:monospace,monospace"> in </span><span style="font-family:monospace,monospace">let import HTML in img [ width 50, style css ]</span></div><div><br></div><div>This is a little bit of a contrived rewrite, but hopefully it shows you what I'd like to be able to do. Please don't fixate too much on this example, it's only intended to illustrate the idea. When defining a large amount of inline styles I think this pays off - I import once to bring all the symbols I need into scope, rather than having to qualify every symbol.</div><div><br></div><div>In reality, it will lead to me writing code like:</div><div><br></div><div><font face="monospace, monospace">myDocument = html</font></div><div><font face="monospace, monospace"> where html =</font></div><div><span style="font-family:monospace,monospace"> div [ style containerStyle ] </span></div><div><font face="monospace, monospace"> [ div [ style rowStyle ] "Hello"</font></div><div><font face="monospace, monospace"> , div [ style rowStyle ] "World!" </font><span style="font-family:monospace,monospace">]</span></div><div><font face="monospace, monospace"> where import HTML</font></div><div><font face="monospace, monospace"> containerStyle =</font></div><div><font face="monospace, monospace"> [ backgroundColor ..., padding ..., margin ... ]</font></div><div><font face="monospace, monospace"> where import CSS</font></div><div><font face="monospace, monospace"> rowStyle = </font></div><div><font face="monospace, monospace"> [ backgroundColor ..., padding ..., margin ... ]</font></div><div><font face="monospace, monospace"> where import CSS</font></div><br>At present the suggestion is a syntax error, so I'm hoping that part won't be too controversial. <br><br>Thoughts?<div><i>ocharles</i></div></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>Haskell-Cafe mailing list</span><br><span><a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a></span><br><span><a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a></span><br></div></blockquote></body></html>