#4316: Interactive "do" notation in GHCi
---------------------------------+------------------------------------------
Reporter: mitar | Owner: vivian
Type: feature request | Status: patch
Priority: normal | Milestone: 7.2.1
Component: GHCi | Version: 6.12.3
Keywords: | Testcase:
Blockedby: | Difficulty:
Os: Unknown/Multiple | Blocking:
Architecture: Unknown/Multiple | Failure: None/Unknown
---------------------------------+------------------------------------------
Changes (by vivian):
* status: new => patch
Comment:
I have a working multiline {{{do}}} patch,
{{{
Control.Monad.State> flip evalStateT 0 $ do
Control.Monad.State| i <- get
Control.Monad.State| lift $ do
Control.Monad.State| putStrLn "Hello World!"
Control.Monad.State| print i
Control.Monad.State|
"Hello World!"
0
Control.Monad.State>
}}}
In order to provide a truly interactive session, the interpreter needs to
know how to (i) run a monad, (ii) pass initial arguments to a monad, and
(iii) take the output of running a monad and feed it to the next line.
Do we manipulate source (fragile) or manipulate HValues? But then we need
to run the typechecker at runtime to make sure we make use the correct
instance of overloaded (GHCi level) plumbing functions.
You also can't just evaluate "lines up to present." What happens when the
last line is currently an assignment?
{{{
Control.Monad.State> flip evalStateT 11 $ do
Control.Monad.State| f <- get
}}}
This patch does not attempt to type the partial type and use the monad
type as prompt.
This patch provides multiline 'do's. Perhaps a new ticket for
"interactive" 'do' could be opened if thee abovementioned points can be
addressed.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4316#comment:11>
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