cduce issueshttps://gitlab.math.univ-paris-diderot.fr/cduce/cduce/-/issues2022-09-29T17:37:04+02:00https://gitlab.math.univ-paris-diderot.fr/cduce/cduce/-/issues/35Improve pretty-printing /parsing of types using UTF-8 Symbols2022-09-29T17:37:04+02:00Kim NguyễnImprove pretty-printing /parsing of types using UTF-8 SymbolsIt would be nice if CDuce was able to pretty-print types with UTF-8 connectives. This would depend on #34. Some requirements :
- It needs to be automatically disabled for terminals that don't support UTF-8
- A user must be able to disabl...It would be nice if CDuce was able to pretty-print types with UTF-8 connectives. This would depend on #34. Some requirements :
- It needs to be automatically disabled for terminals that don't support UTF-8
- A user must be able to disable it with a command-line flag
- This should also work for parsing. A rule of thumb to ensure the correct pretty-printing of types is that CDuce should always be able to parse a type it has pretty-printed (such that both types are equivalent).Usabilityhttps://gitlab.math.univ-paris-diderot.fr/cduce/cduce/-/issues/11"ref", several errors in parsing and typing2021-05-02T14:31:30+02:00Kim Nguyễn"ref", several errors in parsing and typingHere you are some bugs with refs:
<pre>
# type X ('a) = ref 'a;;
Characters 14-17:
Parsing error: [phrase] or ";;" expected (in [toplevel phrases])
# type X ('a) = ref ('a) ;;
Characters 14-22:
Unknown parametric type ref
# type X ('a...Here you are some bugs with refs:
<pre>
# type X ('a) = ref 'a;;
Characters 14-17:
Parsing error: [phrase] or ";;" expected (in [toplevel phrases])
# type X ('a) = ref ('a) ;;
Characters 14-22:
Unknown parametric type ref
# type X ('a) = ref Int ;;
Characters 5-6:
Capture variable not allowed: ref
# type X = ref Int ;;
Characters 5-6:
Capture variable not allowed: ref
# type X = (ref Int) ;;
Characters 11-14:
Capture variable not allowed: ref
</pre>
and a typo
<pre>
let x = ref ('a -> 'a) (fun (x:'b):'b = x);;
Characters 9-44:
Type ref 'a -> 'a constains polymorphic variables
^^^^
</pre>Kim NguyễnKim Nguyễnhttps://gitlab.math.univ-paris-diderot.fr/cduce/cduce/-/issues/5Opposite operator on variables2021-05-02T14:39:48+02:00Kim NguyễnOpposite operator on variablesWhile you can write in CDuce ``-42`` the following is not allowed :
```
# let x = 3 in - x;;
Characters 10-12:
Parsing error: [expression level top] expected after "in" (in [phrase])
```While you can write in CDuce ``-42`` the following is not allowed :
```
# let x = 3 in - x;;
Characters 10-12:
Parsing error: [expression level top] expected after "in" (in [phrase])
```Kim NguyễnKim Nguyễnhttps://gitlab.math.univ-paris-diderot.fr/cduce/cduce/-/issues/4Fix pretty printing of Top types2017-10-16T08:48:07+02:00Kim NguyễnFix pretty printing of Top types```
# let max (x: 'a) (y: 'a): 'a = if ( x >> y) then x else y;;
val max : 'a -> 'a -> 'a = <fun>
# max (42 : Int);;
- : (('a \ (Int)) | Int) -> (('a \ (Int)) | Int) = <fun>
# max (42 : 42|AnyXml|Atom|Arrow);;
- : (('a \ ((Arrow | ...```
# let max (x: 'a) (y: 'a): 'a = if ( x >> y) then x else y;;
val max : 'a -> 'a -> 'a = <fun>
# max (42 : Int);;
- : (('a \ (Int)) | Int) -> (('a \ (Int)) | Int) = <fun>
# max (42 : 42|AnyXml|Atom|Arrow);;
- : (('a \ ((Arrow | Atom))) | (Arrow | AnyXml | Atom | 42)) -> (('a \ (
(Arrow |
Atom))) |
(Arrow |
AnyXml |
Atom | 42)) = <fun>
# max (42 : 42|AnyXml|Atom);;
- : (('a \ (Atom)) | (AnyXml | Atom | 42)) -> (('a \ (Atom)) |
(AnyXml | Atom | 42)) = <fun>
```https://gitlab.math.univ-paris-diderot.fr/cduce/cduce/-/issues/3Fix pretty printing of parentheses in types2021-05-02T14:51:06+02:00Kim NguyễnFix pretty printing of parentheses in typesSome types generate superfluous parentheses:
```
#print_type ('a | 'b ) \'c;;
(('a | 'b) \ ('c))
```
And some others are missing parenthses:
```
#print_type (Int -> Int) & (Bool -> Bool);;
Bool -> Bool & Int -> Int
# #print_type Bool -...Some types generate superfluous parentheses:
```
#print_type ('a | 'b ) \'c;;
(('a | 'b) \ ('c))
```
And some others are missing parenthses:
```
#print_type (Int -> Int) & (Bool -> Bool);;
Bool -> Bool & Int -> Int
# #print_type Bool -> Bool & Int -> Int;;
Bool -> Arrow
```
here we cannot paste the output of the toplevel.Kim NguyễnKim Nguyễnhttps://gitlab.math.univ-paris-diderot.fr/cduce/cduce/-/issues/1Try to improve the parsing of ; in record expressions.2021-05-02T14:45:46+02:00Kim NguyễnTry to improve the parsing of ; in record expressions.Some expressions are more binding than ; and therefore make its use clumsy in record expressions :
```
# let x = { a = ref Int 2 ; b = 42 } ;;
Characters 29-30:
Unbound identifier 'b'
# let x = { b = 42 ; a = ref Int 2 } ;;
val x :...Some expressions are more binding than ; and therefore make its use clumsy in record expressions :
```
# let x = { a = ref Int 2 ; b = 42 } ;;
Characters 29-30:
Unbound identifier 'b'
# let x = { b = 42 ; a = ref Int 2 } ;;
val x : { a={ get=[ ] -> Int set=Int -> [ ] } b=42 } = {
a={ get=<fun>
set=<fun> }
b=42 }
# let x = { a = (ref Int 2) ; b = 42 } ;;
val x : { a={ get=[ ] -> Int set=Int -> [ ] } b=42 } = {
a={ get=<fun>
set=<fun> }
b=42 }
```Kim NguyễnKim Nguyễn