CakeML/cakeml

astPP doesn't print algebraic datatype correctly

開放

#480 建立於 2018年4月6日

 (7 則留言) (0 個反應) (0 位負責人)Standard ML (98 個分叉)auto 404
dev experiencehelp wantedlow reward

倉庫指標

星標
 (1,169 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

Hi,

With the following datatype:

datatype 'a misc_app_list =
   Nil
|  Append of  'a misc_app_list *  'a misc_app_list
|  List of  'a list;

Here's an example of what is produced:

(Append(Append(v2,List([", "])),v5 v1))

I.e:

(Append
  (Append
    (v2,
     List([", "])
    ),
    v5 v1
  )
)

When it should be:

(Append
  (Append
    (v2)
    ( List([", "]) )
  )
  ( v5 v1 )
)

Shortly, Append x y is printed as Append (x, y) instead of Append (x) (y). My guess is that it's printed by the same function than the one used to print lists or things like:

case  v3 of 
   (v2,v1) => (* <- this *)

To fix this, it should not print a , but ) ( between things.

It's working for the constructor List, but I think it's because it takes only one argument, so the bug doesn't show.

貢獻者指南