on master help sign in
Alias on the return type of record constructors
f32c040Evan Czaplicki
compiler/Transform/Declaration.hs+3−1
@@ -88,8 +88,10 @@ toDefs moduleName decl =
88 in [ definition ctor (buildFunction body vars) (foldr T.Lambda tbody tipes) ]
88 in [ definition ctor (buildFunction body vars) (foldr T.Lambda tbody tipes) ]
89
89
90 D.TypeAlias name _ tipe@(T.Record fields ext) ->
90 D.TypeAlias name _ tipe@(T.Record fields ext) ->
91− [ definition name (buildFunction record vars) (foldr T.Lambda tipe args) ]
91+ [ definition name (buildFunction record vars) (foldr T.Lambda result args) ]
92 where
92 where
93+ result = T.Aliased (typeVar name) tipe
94+
93 args = map snd fields ++ maybe [] (:[]) ext
95 args = map snd fields ++ maybe [] (:[]) ext
94
96
95 var = A.none . E.localVar
97 var = A.none . E.localVar