agda / agda-stdlib

The Agda standard library

Home Page:https://wiki.portal.chalmers.se/agda/Libraries/StandardLibrary

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is `Data.Integer.Base.signAbs` unnecessarily strict?

jamesmckinna opened this issue · comments

The definition seems unnecessarily strict; why not instead write the following, which has moreover the advantage (I think!?) that signAbs i is then definitionally equal to sign i ◂ ∣ i ∣...

data SignAbs : Set where
  _◂_ : (s : Sign) (n : ℕ)  SignAbs (s ◃ n)

signAbs :  i  SignAbs i
signAbs -[1+ n ] = Sign.- ◂ ℕ.suc n
signAbs + n      = Sign.+ ◂ n

So like all bad good ideas/good bad ideas, I failed to test this first, and it doesn't typecheck...
...UPDATED unless you also change the auxiliary definition s ◃ n and ... don't try this at home.
Sheer folly on my part.