Skip to content

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

Open
@1inguini

Description

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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions