constraints icon indicating copy to clipboard operation
constraints copied to clipboard

(:-) a closed category?

Open Zemyla opened this issue 7 years ago • 3 comments

It seems to be. There is an exponential, which is (:=>), and apply and uncurry combinators:

apply :: forall a b. (a :=> b, a) :- b
apply = Sub $ (Dict :: Dict b) \\ (ins :: a :- b)

uncurry :: forall a b c. (a :- (b :=> c)) -> ((a, b) :- c)
uncurry s = unmapDict $ \Dict -> (Dict :: Dict c) \\ ((ins :: b :- c) \\ s)

But there should also be a curry combinator:

curry :: forall a b c. ((a, b) :- c) -> (a :- (b :=> c))
curry = ???

And it seems like that can't be implemented without unsafe operations.

Zemyla avatar Nov 15 '17 03:11 Zemyla

I just realized that :=> isn't the canonical exponential type, because it induces a functional dependency. There could be a type family, something like ==>, which is a constraint but doesn't have the same dependency.

Zemyla avatar Nov 19 '17 18:11 Zemyla

These things can be implemented with Simon's -XQuantifiedConstraints branch

Icelandjack avatar Mar 06 '18 19:03 Icelandjack

Is found here https://github.com/ghc/ghc/tree/wip/T2893, I made tickets for curry and uncurry

Icelandjack avatar Mar 06 '18 19:03 Icelandjack