[GHC] #2150: allow definition of functions in the interpreter

GHC trac at galois.com
Thu Mar 13 00:49:39 EDT 2008


#2150: allow definition of functions in the interpreter
--------------------------------+-------------------------------------------
    Reporter:  ahrivera         |       Owner:         
        Type:  feature request  |      Status:  new    
    Priority:  normal           |   Component:  GHCi   
     Version:  6.8.2            |    Severity:  normal 
    Keywords:                   |    Testcase:         
Architecture:  Unknown          |          Os:  Unknown
--------------------------------+-------------------------------------------
 Right now, the only way to define functions is through the .hs files.
 Other interpreted languages such as Python allow the user to define
 functions in the command  line.  This is very helpful when one wants to
 prototype some quick functions.

 One way to do it could be to detect when one declares the function and
 then enable a mode where one can add definitions.  For example:

 Prelude> x:: Int ->Int[[BR]]

 *definition*> x a = a + 1[[BR]]

 *definition*>[[BR]]

 Prelude> x 10[[BR]]

 11[[BR]]

 Prelude>[[BR]]


 Please consider adding this functionality to GHCI.

 Thanks

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


More information about the Glasgow-haskell-bugs mailing list