@@ -104,29 +104,27 @@ deepDealias tipe =
104104
105105dealias :: [(String, Type v)] -> Type v -> Type v
106106dealias args tipe =
107− replace (Map.fromList args) tipe
107+ dealiasHelp (Map.fromList args) tipe
108108
109109
110−replace :: Map.Map String (Type var) -> Type var -> Type var
111−replace typeTable t =
112− let go = replace typeTable in
113− case t of
110+dealiasHelp :: Map.Map String (Type var) -> Type var -> Type var
111+dealiasHelp typeTable tipe =
112+ let go = dealiasHelp typeTable in
113+ case tipe of
114114 Lambda a b ->
115115 Lambda (go a) (go b)
116116
117117 Var x ->
118− Map.findWithDefault t x typeTable
118+ Map.findWithDefault tipe x typeTable
119119
120120 Record fields ext ->
121121 Record (map (second go) fields) (fmap go ext)
122122
123123 Aliased original args t' ->
124− let typeTable' = foldr Map.delete typeTable (map fst args)
125− in
126− Aliased original (map (second go) args) (replace typeTable' t')
124+ Aliased original (map (second go) args) t'
127125
128126 Type _ ->
129− t
127+ tipe
130128
131129 App f args ->
132130 App (go f) (map go args)