Idris-dev icon indicating copy to clipboard operation
Idris-dev copied to clipboard

Data.Primitives.Views.divides behaves odd with negative dividend

Open 1inguini opened this issue 4 years ago • 0 comments

Steps to Reproduce

module Issue

import Data.Primitives.Views

divTest : (Integer, Integer) -> (Integer,Integer)
divTest (x, y) with (divides x y)
  divTest (x, 0) | DivByZero = (x, 0)
  divTest (x@(y * _ + _), y) | DivBy _ = (x, y)

it : Issue.divTest <$> [(-13, 4), (-13, -4)] = [(-13, 4), (-13, -4)]
it = Refl

Expected Behavior

type check passes

Observed Behavior

   |
11 | it = Refl
   |      ~~~~
When checking right hand side of it with expected type
        divTest <$> [((-13), 4), ((-13), (-4))] = [((-13), 4), ((-13), (-4))]

Type mismatch between
        x = x (Type of Refl)
and
        [(-11, 4), (-11, -4)] = [(-13, 4), (-13, -4)] (Expected type)

Specifically:
        Type mismatch between
                -11
        and
                -13

1inguini avatar Feb 13 '21 14:02 1inguini