Skip to content

add liftCompare & friends #310

Open
Open

Description

@flip111

Could a function like this be added? https://hackage.haskell.org/package/base-4.19.0.0/docs/Data-Functor-Classes.html#v:liftCompare

In which module should such function go?

Activity

  1. JordanMartinez commented on Jan 25, 2024

    @JordanMartinez
    Contributor

    What is f in the above context? Due to liftCompare lacking any type class constraints, how would you get the a or b out of f?

  2. flip111 commented on Jan 26, 2024

    @flip111
    Author

    Does the class definition give sufficient information?

    class (Eq1 f, forall a. Ord a => Ord (f a)) => Ord1 (f :: Type -> Type) where

    Related
    https://pursuit.purescript.org/packages/purescript-prelude/6.0.1/docs/Data.Ord#t:Ord1
    https://pursuit.purescript.org/packages/purescript-prelude/6.0.1/docs/Data.Eq#t:Eq1

  3. JordanMartinez commented on Jan 26, 2024

    @JordanMartinez
    Contributor

    We don't yet support this syntax on the left side of the =>:

    forall a. Ord a => Ord (f a)

    How would we implement this?

  4. garyb commented on Jan 26, 2024

    @garyb
    Member

    How would we implement this?

    Part of the purpose of Ord1 is to avoid that constraint, there's an Ord a constraint on compare1 instead.

  5. JordanMartinez commented on Jan 26, 2024

    @JordanMartinez
    Contributor

    Ok, I misread the Haskell docs. I thought liftCompare was a function, not a type class member... That explains a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

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