On Wed, Aug 5, 2015 at 6:28 AM, Oliver Charles <ollie@ocharles.org.uk> wrote:
I find myself wanting to be able to say something like:

foo = ...
  where import Something.Specific

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.

The biggest problem with this is the question of instances. The typechecker requires that all instances be global; otherwise you can break invariants. (Consider what happens if a different Ord instance is in scope in that part of the program.)

I wonder if this use case can be addressed by a different mechanism (extension), though:

    import qualified Something.Specific
    {- ... -}
    foo = ...
      where using Something.Specific -- names would be unqualified in this scope

--
brandon s allbery kf8nh                               sine nomine associates
allbery.b@gmail.com                                  ballbery@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net