X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=c%CE%BBash%2FCLasH%2FUtils%2FCore%2FCoreTools.hs;h=bf2ca27be3b6717b5262a8f9c1770397924be605;hb=b1339d81821c6e968a79894c3ebb4bfc3d7f96c2;hp=cd85b4d0102e257d8f650782e9fdac516fbe6c2f;hpb=843f4ae4fae495fd340022febf4bf42bac9000a0;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git diff --git "a/c\316\273ash/CLasH/Utils/Core/CoreTools.hs" "b/c\316\273ash/CLasH/Utils/Core/CoreTools.hs" index cd85b4d..bf2ca27 100644 --- "a/c\316\273ash/CLasH/Utils/Core/CoreTools.hs" +++ "b/c\316\273ash/CLasH/Utils/Core/CoreTools.hs" @@ -193,6 +193,10 @@ is_simple _ = False has_free_tyvars :: CoreSyn.CoreExpr -> Bool has_free_tyvars = not . VarSet.isEmptyVarSet . (CoreFVs.exprSomeFreeVars Var.isTyVar) +-- Does the given type have any free type vars? +ty_has_free_tyvars :: Type.Type -> Bool +ty_has_free_tyvars = not . VarSet.isEmptyVarSet . Type.tyVarsOfType + -- Does the given CoreExpr have any free local vars? has_free_vars :: CoreSyn.CoreExpr -> Bool has_free_vars = not . VarSet.isEmptyVarSet . CoreFVs.exprFreeVars @@ -361,8 +365,8 @@ genUniques' subst (CoreSyn.App f arg) = do f' <- genUniques' subst f arg' <- genUniques' subst arg return (CoreSyn.App f' arg') -genUniques' subst (CoreSyn.Lam bndr res) | CoreSyn.isTyVar bndr = - error $ "Cloning type variables not supported!" +-- Don't change type abstractions +genUniques' subst expr@(CoreSyn.Lam bndr res) | CoreSyn.isTyVar bndr = return expr genUniques' subst (CoreSyn.Lam bndr res) = do -- Generate a new unique for the bound variable (subst', bndr') <- genUnique subst bndr