Skip to content

Commit 188f167

Browse files
author
Alex McKenna
committed
Fully normalize type families in normalizeType.
Normalize type did not recurse on the result of reducing a type family, meaning if a type family reduced to another type family it would not be normalized.
1 parent 16b8be1 commit 188f167

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Fixed: #1469
2+
The normalizeType function now fully normalizes types which require calls to
3+
reduceTypeFamily.
4+

clash-lib/src/Clash/Core/Type.hs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,14 @@ normalizeType tcMap = go
646646
let args' = map go args
647647
ty' = mkTyConApp tcNm args'
648648
in case reduceTypeFamily tcMap ty' of
649-
Just ty'' -> ty''
649+
-- TODO Instead of recursing here, reduceTypeFamily should
650+
-- ensure that if the result is a reducible type family it is
651+
-- also reduced. This would reduce traversals over a type.
652+
--
653+
-- It may be a good idea to keep reduceTypeFamily only reducing
654+
-- one family, and definiing reduceTypeFamilies to reduce all
655+
-- it encounters in one traversal.
656+
Just ty'' -> go ty''
650657
Nothing -> ty'
651658
FunTy ty1 ty2 -> mkFunTy (go ty1) (go ty2)
652659
OtherType (ForAllTy tyvar ty')

0 commit comments

Comments
 (0)