hawk icon indicating copy to clipboard operation
hawk copied to clipboard

Support fancy import statements

Open gelisam opened this issue 11 years ago • 3 comments

Such as

import Prelude hiding (lines, unlines)

for example.

gelisam avatar Aug 12 '13 01:08 gelisam

While reading the documentation for hint, I stumbled upon a function which lists all the bindings exported by a module. If we need any hacks in order to support fancy import statements, that function will probably be help to implement them.

gelisam avatar Aug 12 '13 02:08 gelisam

I have an idea: for selective and hiding imports we can just populate the user prelude.hs with exports. So a Prelude.hs like:

import Data.List (length)

will be converted to

module Hawk.M12345678 (length) where
import Data.List (length)

same for hiding, we can take everything exported by the module and remove what has been hidden. I think hint has something to get what is exported by a module. This will require a bit of work, but it can be done and it is invisible to the user

melrief avatar Aug 12 '13 08:08 melrief

This is exactly the kind of magic I like :)

gelisam avatar Aug 12 '13 13:08 gelisam