@@ -80,17 +80,29 @@ canonicalizeAlias env (name, tvars, dealiasedTipe) tipes =
80 tvarsLen = length tvars
80 tvarsLen = length tvars
82 msg :: String
82 msg :: String
83− msg = "Type alias '" ++ Var.toString name ++ "' expects " ++ show tvarsLen ++
84+ "Type alias '" ++ Var.toString name ++ "' expects " ++ show tvarsLen ++
84− " type argument" ++ (if tvarsLen == 1 then "" else "s") ++
85+ " type argument" ++ (if tvarsLen == 1 then "" else "s") ++
85− " but was given " ++ show tipesLen
86+ " but was given " ++ show tipesLen
87 replace :: Map.Map String T.CanonicalType -> T.CanonicalType -> T.CanonicalType
88 replace :: Map.Map String T.CanonicalType -> T.CanonicalType -> T.CanonicalType
88 replace typeTable t =
89 replace typeTable t =
89 let go = replace typeTable in
90 let go = replace typeTable in
91− T.Lambda a b -> T.Lambda (go a) (go b)
93+ T.Lambda (go a) (go b)
92− T.Var x -> Map.findWithDefault t x typeTable
96+ Map.findWithDefault t x typeTable
98+ T.Record fields ext ->
93− T.Record fields ext -> T.Record (map (second go) fields) (fmap go ext)
99+ T.Record (map (second go) fields) (fmap go ext)
101+ T.Aliased original t' ->
94− T.Aliased original t' -> T.Aliased original (go t')
102+ T.Aliased original (go t')
95− T.Type _ -> t
104+ T.Type _ ->
96− T.App f args -> T.App (go f) (map go args)
108+ T.App (go f) (map go args)