diff --git a/changelog/2020-08-07T16_33_09+02_00_normalize_types.md b/changelog/2020-08-07T16_33_09+02_00_normalize_types.md new file mode 100644 index 0000000000..d3c42221be --- /dev/null +++ b/changelog/2020-08-07T16_33_09+02_00_normalize_types.md @@ -0,0 +1,4 @@ +Fixed: #1469 +The normalizeType function now fully normalizes types which require calls to +reduceTypeFamily. + diff --git a/clash-lib/src/Clash/Core/Type.hs b/clash-lib/src/Clash/Core/Type.hs index cc3dd16312..6a8f2590de 100644 --- a/clash-lib/src/Clash/Core/Type.hs +++ b/clash-lib/src/Clash/Core/Type.hs @@ -646,7 +646,14 @@ normalizeType tcMap = go let args' = map go args ty' = mkTyConApp tcNm args' in case reduceTypeFamily tcMap ty' of - Just ty'' -> ty'' + -- TODO Instead of recursing here, reduceTypeFamily should + -- ensure that if the result is a reducible type family it is + -- also reduced. This would reduce traversals over a type. + -- + -- It may be a good idea to keep reduceTypeFamily only reducing + -- one family, and definiing reduceTypeFamilies to reduce all + -- it encounters in one traversal. + Just ty'' -> go ty'' Nothing -> ty' FunTy ty1 ty2 -> mkFunTy (go ty1) (go ty2) OtherType (ForAllTy tyvar ty')