#4316: Interactive "do" notation in GHCi
---------------------------------+------------------------------------------
    Reporter:  mitar             |       Owner:              
        Type:  feature request   |      Status:  new         
    Priority:  normal            |   Component:  GHCi        
     Version:  6.12.3            |    Keywords:              
    Testcase:                    |   Blockedby:              
          Os:  Unknown/Multiple  |    Blocking:              
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown
---------------------------------+------------------------------------------

Comment(by vivian):

 Replying to [comment:3 mitar]:
 > Replying to [comment:2 vivian]:
 > Wouldn't it be better if things would be interpreted immediately?

 This would require GHCi to somehow know how to run arbitrary monads.  This
 is a problem as each monad has a datatype-specific run function.  Some
 monads return {{{Value,State}}} (StateT), others return {{{Either Error
 Value}}} (ErrorT), and so on.

 {{{
 Prelude> flip evalStateT 1 $ do
 StateT Int IO a |            i <- get
 StateT Int IO a |            lift $ putStrLn $ show i
 1
 }}}
 somehow insert
 {{{
 flip runStateT <<<missing parameter>>> $ do
 }}}
 before the next line:
 {{{
 StateT Int IO a |            return $ i + 1
 StateT Int IO a |
 2
 Prelude>
 }}}

 The difference is between "prompting for more input," which relies only on
 the original function call {{{flip evalStateT}}}, a 'syntactic' operation,
 and multiple evaluations, a 'semantic' operation.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4316#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to