unisonweb / unison

A friendly programming language from the future
https://unison-lang.org
Other
5.78k stars 270 forks source link

Possible pretty-printing issue related to #1675 #1676

Open stew opened 4 years ago

stew commented 4 years ago

When we try to overcome the issue in #1675 with a more explicit type:

ability Bar2 where fun : Nat -> {Bar2}(Nat -> Nat)

this produces:

ability Bar2 where fun : Nat ->{Bar2} Nat -> Nat

but we think this is a pretty-printing issue, because this works:

bar2handler = cases
 { Bar2.fun a -> k } -> handle k (x -> x + a) with bar2handler
 { a } -> a
> handle Bar2.fun 3 4 with bar2handler

(which tells us that the arity of the pattern match is what we wanted, not what it printed)

anovstrup commented 4 years ago

@stew Are those declarations different? I would expect the function type constructor -> to be right-associative, so that those two would be identical. The pattern arity is presumably determined by which argument requires the {Bar2} ability.