Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
c5a96ed0
Commit
c5a96ed0
authored
Jun 14, 2002
by
simonpj
Browse files
[project @ 2002-06-14 14:00:49 by simonpj]
Wibble in Generics; fixes str002
parent
9505a207
Changes
1
Hide whitespace changes
Inline
Side-by-side
ghc/compiler/types/Generics.lhs
View file @
c5a96ed0
...
...
@@ -16,7 +16,7 @@ import TcType ( tcSplitTyConApp_maybe, tcSplitSigmaTy, tcSplitSigmaTy )
import DataCon ( DataCon, dataConOrigArgTys, dataConWrapId, isExistentialDataCon )
import TyCon ( TyCon, tyConTyVars, tyConDataCons_maybe,
tyConGenInfo, isNewTyCon,
newTyConRep,
isBoxedTupleTyCon
tyConGenInfo, isNewTyCon, isBoxedTupleTyCon
)
import Name ( Name, mkSystemName )
import CoreSyn ( mkLams, Expr(..), CoreExpr, AltCon(..),
...
...
@@ -31,7 +31,7 @@ import TysWiredIn ( genericTyCons,
genUnitTyCon, genUnitDataCon, plusTyCon, inrDataCon,
inlDataCon, crossTyCon, crossDataCon
)
import IdInfo ( noCaf
NoTyGen
IdInfo, setUnfoldingInfo, setArityInfo )
import IdInfo ( noCafIdInfo, setUnfoldingInfo, setArityInfo )
import CoreUnfold ( mkTopUnfolding )
import Maybe ( isNothing )
...
...
@@ -271,9 +271,9 @@ mkTyConGenInfo tycon [from_name, to_name]
tycon_ty = mkTyConApp tycon tyvar_tys -- T a b c
tyvar_tys = mkTyVarTys tyvars
from_id_info = noCaf
NoTyGen
IdInfo `setUnfoldingInfo` mkTopUnfolding from_fn
from_id_info = noCafIdInfo `setUnfoldingInfo` mkTopUnfolding from_fn
`setArityInfo` exprArity from_fn
to_id_info = noCaf
NoTyGen
IdInfo `setUnfoldingInfo` mkTopUnfolding to_fn
to_id_info = noCafIdInfo `setUnfoldingInfo` mkTopUnfolding to_fn
`setArityInfo` exprArity to_fn
-- It's important to set the arity info, so that
-- the calling convention (gotten from arity)
...
...
@@ -284,9 +284,9 @@ mkTyConGenInfo tycon [from_name, to_name]
(from_fn, to_fn, rep_ty)
| isNewTyCon tycon
= ( mkLams tyvars $ Lam x $ mkNewTypeBody tycon
newrep
_ty (Var x),
= ( mkLams tyvars $ Lam x $ mkNewTypeBody tycon
the_arg
_ty (Var x),
Var (dataConWrapId the_datacon),
newrep
_ty )
the_arg
_ty )
| otherwise
= ( mkLams tyvars $ Lam x $ Case (Var x) x from_alts,
...
...
@@ -300,8 +300,12 @@ mkTyConGenInfo tycon [from_name, to_name]
----------------------
-- Newtypes only
[the_datacon] = datacons
(_, newrep_ty) = newTyConRep tycon
the_arg_ty = head (dataConOrigArgTys the_datacon)
-- NB: we use the arg type of the data constructor, rather than
-- the representation type of the newtype; in degnerate (recursive)
-- cases the rep type might be (), but the arg type is still T:
-- newtype T = MkT T
----------------------
-- Non-newtypes only
-- Recurse over the sum first
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment