diff options
| author | Simon Marlow <marlowsd@gmail.com> | 2011-09-16 13:40:53 +0100 |
|---|---|---|
| committer | Simon Marlow <marlowsd@gmail.com> | 2011-09-21 09:52:59 +0100 |
| commit | 3db757241ce7fb99c096c30481aefa86bb9855a1 (patch) | |
| tree | 003ea696a39cf558b975cc4d4b0e7bd88c0867ad /compiler/vectorise/Vectorise.hs | |
| parent | 9de6f19e5de702967a9411b01c06734d3b67eea8 (diff) | |
| download | haskell-3db757241ce7fb99c096c30481aefa86bb9855a1.tar.gz | |
Add support for all top-level declarations to GHCi
This is work mostly done by Daniel Winograd-Cort during his
internship at MSR Cambridge, with some further refactoring by me.
This commit adds support to GHCi for most top-level declarations that
can be used in Haskell source files. Class, data, newtype, type,
instance are all supported, as are Type Family-related declarations.
The current set of declarations are shown by :show bindings. As with
variable bindings, entities bound by newer declarations shadow earlier
ones.
Tests are in testsuite/tests/ghci/scripts/ghci039--ghci054.
Documentation to follow.
Diffstat (limited to 'compiler/vectorise/Vectorise.hs')
| -rw-r--r-- | compiler/vectorise/Vectorise.hs | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/compiler/vectorise/Vectorise.hs b/compiler/vectorise/Vectorise.hs index 649f33f2db..083b2b05a5 100644 --- a/compiler/vectorise/Vectorise.hs +++ b/compiler/vectorise/Vectorise.hs @@ -61,7 +61,7 @@ vectoriseIO hsc_env guts -- Vectorise a single module, in the VM monad. -- vectModule :: ModGuts -> VM ModGuts -vectModule guts@(ModGuts { mg_types = types +vectModule guts@(ModGuts { mg_tcs = tycons , mg_binds = binds , mg_fam_insts = fam_insts , mg_vect_decls = vect_decls @@ -69,12 +69,14 @@ vectModule guts@(ModGuts { mg_types = types = do { dumpOptVt Opt_D_dump_vt_trace "Before vectorisation" $ pprCoreBindings binds - -- Vectorise the type environment. This will add vectorised type constructors, their - -- representaions, and the conrresponding data constructors. Moreover, we produce - -- bindings for dfuns and family instances of the classes and type families used in the - -- DPH library to represent array types. - ; (types', new_fam_insts, tc_binds) <- vectTypeEnv types [vd - | vd@(VectType _ _) <- vect_decls] + -- Vectorise the type environment. This will add vectorised + -- type constructors, their representaions, and the + -- conrresponding data constructors. Moreover, we produce + -- bindings for dfuns and family instances of the classes + -- and type families used in the DPH library to represent + -- array types. + ; (tycons', new_fam_insts, tc_binds) <- vectTypeEnv tycons [vd + | vd@(VectType _ _) <- vect_decls] ; (_, fam_inst_env) <- readGEnv global_fam_inst_env @@ -82,7 +84,7 @@ vectModule guts@(ModGuts { mg_types = types ; binds_top <- mapM vectTopBind binds ; binds_imp <- mapM vectImpBind [imp_id | Vect imp_id _ <- vect_decls, isGlobalId imp_id] - ; return $ guts { mg_types = types' + ; return $ guts { mg_tcs = tycons' , mg_binds = Rec tc_binds : (binds_top ++ binds_imp) , mg_fam_inst_env = fam_inst_env , mg_fam_insts = fam_insts ++ new_fam_insts |
