Skip to content

Fully normalize type families in normalizeType. #1470

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog/2020-08-07T16_33_09+02_00_normalize_types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Fixed: #1469
The normalizeType function now fully normalizes types which require calls to
reduceTypeFamily.

9 changes: 8 additions & 1 deletion clash-lib/src/Clash/Core/Type.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down