[Haskell-cafe] Syntax extension - adding import support to let/where bindings

Evan Laforge qdunkan at gmail.com
Wed Aug 5 16:43:22 UTC 2015


> In practice I use a lot more than just two symbols. The point is the
> repeated qualification quickly introduces more noise and obscures the intent
> of the code.

Well, qualification is only necessary for the symbols that conflict,
right?  It seems to me that if you want an EDSL with a certain
prelude, you have to make sure the prelude symbols are all distinct.
If you want to compose two DSLs, then you could make a third prelude
that imports the other two, but renames colliding symbols.

Unless there are many collisions... in which case, maybe don't define
your EDSLs like that in the first place?

Currently if you want to  figure out all imports you parse the top of
the file and can stop at the first definition.  But with this feature
you have to parse the whole file and thus understand all haskell
grammar, including all extensions in use.  I'd have to give up on my
fast deps chaser and switch to slow ghc -M... which is maybe the right
way anyway, I don't know.

Ok, to be fair, I wouldn't, because I could choose to not use that
feature, but in *theory* :)  And while "you don't have to use it" is
always brought up, it seems to me the more successful the feature is
the more likely you do have to use it.

On the other hand, lots of languages have a "local open" feature like
this.  I think many of them make you first import the module, and then
you can "open" it in a local scope.  This would address both my "parse
the whole file for imports" objection and the "what about instances",
because module importing would be unchanged.


More information about the Haskell-Cafe mailing list