Alias on the return type of record constructors
commitf32c0406c5d20d870331ddbad85464f599cd4fbb
authorEvan Czaplicki <info@elm-lang.org>
dateThu 5 Jun 2014, 14:41 (12 years ago)
parentb16e876
compiler/Transform/Declaration.hs+3−1
@@ -88,8 +88,10 @@ toDefs moduleName decl =
8888 in [ definition ctor (buildFunction body vars) (foldr T.Lambda tbody tipes) ]
8989
9090 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) ]
9292 where
93+ result = T.Aliased (typeVar name) tipe
94+
9395 args = map snd fields ++ maybe [] (:[]) ext
9496
9597 var = A.none . E.localVar