unisonweb / base

Unison base libraries

Home Page:https://share.unison-lang.org/@unison/base

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Suggestion: rename `UTCOffset.+` to `UTCOffset.addHours`

pchiusano opened this issue · comments

Where previously, one could write:

inc x = x + 1

With latest base you'll get a type error (ambiguous TDNR) due to the presence of (UTCOffset.+) : UTCOffset -> Nat -> UTCOffset.

Nat addition with a constant is quite common as a subexpression, so the presence of this operation in base makes TDNR less useful.

It'd be one thing if people were adding utc offsets willy nilly in their code, but it's a pretty uncommon operation compared to Nat addition. So I'd rename to UTCOffset.addHours which is a bit longer but probably clearer anyway since you don't have to guess or read the docs to know the units of the Nat.

commented

This is resolved in main. The idea was that you could write UTC - 4 or UTC + 1.