Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add liftCompare & friends #310

Open
flip111 opened this issue Jan 24, 2024 · 5 comments
Open

add liftCompare & friends #310

flip111 opened this issue Jan 24, 2024 · 5 comments

Comments

@flip111
Copy link

flip111 commented Jan 24, 2024

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?

@JordanMartinez
Copy link
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?

@flip111
Copy link
Author

flip111 commented Jan 26, 2024

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

@JordanMartinez
Copy link
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?

@garyb
Copy link
Member

garyb commented Jan 26, 2024

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.

@JordanMartinez
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants