#5910: Holes with other constraints
----------------------------------------+-----------------------------------
    Reporter:  xnyhps                   |       Owner:                  
        Type:  feature request          |      Status:  new             
    Priority:  normal                   |   Milestone:                  
   Component:  Compiler (Type checker)  |     Version:  7.5             
    Keywords:  holes                    |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple         |     Failure:  Other           
  Difficulty:  Unknown                  |    Testcase:                  
   Blockedby:                           |    Blocking:                  
     Related:                           |  
----------------------------------------+-----------------------------------

Comment(by hamish):

 How hard would it be to implement a -fdefer-undefined-errors that would
 treat all undefined symbols as holes?

 Then when you hit Ctrl+R to resolve them in Leksah we could include an
 option to add the missing function to the module  (currently it will only
 add an import if the function is defined in a some other module).  User
 types...

 {{{
 main = putStrLn hello
 }}}

 Which results in a warning that hello is undefined.  They then they hit
 Ctrl+R and we would add...

 {{{
 hello :: String
 hello = undefined
 }}}

 and select the word undefined in the above so they can start typing.

 The problem with _? is we won't know when to include it until it is too
 late.  We could just add _? to whatever the user is typing, but for all we
 know there could be a "hello" in scope and we might just be breaking valid
 code.  Also what if the user deletes an existing function we have no way
 to know to add _? to the calling site to get a suitable type for the now
 missing function.

 If we need the type for autocomplete we will get it if the symbol is
 undefined (because it will be treated as a hole).  If it is defined we
 probably don't want to autocomplete, but if the user presses Ctrl+Space we
 can change "hello" to "hello_Leksah_Autocomplete" to get it.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5910#comment:19>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to