-----------------------------------------------------------------------------
--- $Id: InteractiveUI.hs,v 1.6 2000/11/20 16:51:35 simonmar Exp $
+-- $Id: InteractiveUI.hs,v 1.7 2000/11/21 10:48:20 simonmar Exp $
--
-- GHC Interactive User Interface
--
Nothing -> throwDyn (OtherError "no module context in which to run the expression")
Just mod -> do
dflags <- io (readIORef v_DynFlags)
- (st, maybe_hvalue) <-
+ (new_cmstate, maybe_hvalue) <-
io (cmGetExpr (cmstate st) dflags mod expr)
+ setGHCiState st{cmstate = new_cmstate}
case maybe_hvalue of
Nothing -> return ()
Just hv -> io (cmRunExpr hv)
NonRecP bind body -> doNonRec 'P' bind body
NonRecI bind body -> doNonRec 'I' bind body
+ RecP binds body -> doRec 'P' binds body
+ RecI binds body -> doRec 'I' binds body
+
ConApp i -> doConApp "" i ([] :: [IExpr con var])
ConAppI i a1 -> doConApp "" i [a1]
ConAppP i a1 -> doConApp "" i [a1]
doNonRec repchr bind body
= vcat [text "let" <> char repchr <+> pprIBind bind, text "in", pprIExpr body]
+ doRec repchr binds body
+ = vcat [text "letrec" <> char repchr <+> vcat (map pprIBind binds),
+ text "in", pprIExpr body]
+
doCasePrim repchr b sc alts def
= sep [text "CasePrim" <> char repchr
<+> pprIExpr sc <+> text "of" <+> ppr b <+> char '{',
\section[TcDefaults]{Typechecking \tr{default} declarations}
\begin{code}
-module TcDefaults ( tcDefaults ) where
+module TcDefaults ( tcDefaults, defaultDefaultTys ) where
#include "HsVersions.h"
\end{code}
\begin{code}
-default_default = [integerTy, doubleTy]
+defaultDefaultTys = [integerTy, doubleTy]
tcDefaults :: [RenamedHsDecl]
-> TcM [Type] -- defaulting types to heave
-- in Disambig.
tcDefaults decls = tc_defaults [default_decl | DefD default_decl <- decls]
-tc_defaults [] = returnTc default_default
+tc_defaults [] = returnTc defaultDefaultTys
tc_defaults [DefaultDecl [] locn]
= returnTc [] -- no defaults
import Inst ( plusLIE )
import TcBinds ( tcTopBinds )
import TcClassDcl ( tcClassDecls2 )
-import TcDefaults ( tcDefaults )
+import TcDefaults ( tcDefaults, defaultDefaultTys )
import TcExpr ( tcMonoExpr )
import TcEnv ( TcEnv, InstInfo(iDFunId), tcExtendGlobalValEnv,
isLocalThing, tcSetEnv, tcSetInstEnv, initTcEnv, getTcGEnv
typecheckExpr dflags pcs hst unqual this_mod (expr, decls)
= typecheck dflags pcs hst unqual $
+ -- use the default default settings, i.e. [Integer, Double]
+ tcSetDefaultTys defaultDefaultTys $
tcImports pcs hst get_fixity this_mod decls `thenTc` \ (env, new_pcs, local_inst_info, deriv_binds, local_rules) ->
ASSERT( null local_inst_info && nullBinds deriv_binds && null local_rules )