Skip to content
This repository was archived by the owner on Nov 17, 2020. It is now read-only.
This repository was archived by the owner on Nov 17, 2020. It is now read-only.

Derived Ord instances do a weird substitution #176

Description

@Lysxia

Input:

data F a = G a a deriving (Eq, Ord)

In the definition of (<) (Ord__F_op_zl__), the comparison for the first field should use GHC.Base.compare but instead it uses Ord__F_compare:

Local Definition Ord__F_compare {inst_a} `{GHC.Base.Ord inst_a}
   : F inst_a -> F inst_a -> comparison :=
  fun a b =>
    let 'G a1 a2 := a in
    let 'G b1 b2 := b in
    match (GHC.Base.compare a1 b1) with
    | Lt => Lt
    | Eq => (GHC.Base.compare a2 b2)
    | Gt => Gt
    end.

Local Definition Ord__F_op_zl__ {inst_a} `{GHC.Base.Ord inst_a}
   : F inst_a -> F inst_a -> bool :=
  fun a b =>
    let 'G a1 a2 := a in
    let 'G b1 b2 := b in
    match (Ord__F_compare a1 b1) with
    | Lt => true
    | Eq => (a2 GHC.Base.< b2)
    | Gt => false
    end.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions