The function at the end of this email walks over a Type, basically
(recursivey) replacing it with its coreView. The resulting tree has no
PredTy's except for (PredTy (EqPred _ _)).
How problematic is it for a core-to-core translation to replace all the
Type's in an Expr with their coreView-ification this way? Is it likely
to cause compilation/core-lint failures, or is it just ugly?
I suppose that at the very least it makes it harder to debug passes
which happen after the coreView-ifying pass. And I realize that
actually replacing a type with its coreView (rather than calling
coreView "on demand") is not the preferred way of doing things.
Thanks,
- a
coreViewDeep :: Type -> Type
coreViewDeep t =
case t of
TyVarTy tv -> TyVarTy tv
FunTy arg res -> FunTy (coreViewDeep arg) (coreViewDeep res)
AppTy fun arg -> AppTy (coreViewDeep fun) (coreViewDeep arg)
ForAllTy fun arg -> ForAllTy fun (coreViewDeep arg)
TyConApp tc tys -> let t' = TyConApp tc (map coreViewDeep tys)
in case coreView t' of
Nothing -> t'
Just t'' -> t''
PredTy p -> case coreView t of
Nothing -> PredTy p
Just t' -> t'
_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc