@@ -84,16 +84,23 @@ typeAlias = do
84 Left msg -> fail msg
84 Left msg -> fail msg
85 Right t -> return (TypeAlias alias [1..n] t : ctor)
85 Right t -> return (TypeAlias alias [1..n] t : ctor)
86 where ctor = case tipe of
86 where ctor = case tipe of
87+ RecordPT extension kvs ->
87− RecordPT _ kvs -> [toConstructor start end alias kvs]
88+ [toConstructor start end alias extension kvs]
90−toConstructor start end alias kvs =
91+toConstructor start end alias Nothing kvs =
91 Definition (FnDef alias args (loc (Record rec)))
92 Definition (FnDef alias args (loc (Record rec)))
93 loc = pos start end
94 loc = pos start end
94 args = map fst kvs
95 args = map fst kvs
95 rec = map (\a -> (a, [], loc (Var a))) args
96 rec = map (\a -> (a, [], loc (Var a))) args
96−
97+toConstructor start end alias (Just _) kvs =
98+ Definition (FnDef alias (args++["_ext_"]) (loc rec))
102+ rec = foldl insert (Var "_ext_") (zip args (map (loc . Var) args))
103+ insert e (k,v) = Insert (loc e) k v
98typeAnnotation :: IParser Def
105typeAnnotation :: IParser Def
99typeAnnotation = TypeAnnotation <$> try start <*> (toType <$> typeExpr)
106typeAnnotation = TypeAnnotation <$> try start <*> (toType <$> typeExpr)