purescript / purescript-prelude

The PureScript Prelude
BSD 3-Clause "New" or "Revised" License
163 stars 88 forks source link

Adopt some of category sub classes #133

Closed safareli closed 6 years ago

safareli commented 7 years ago

Recently I saw this talk by @conal and there are some interesting aspects, like introducing Cartasian and Closed classes.

With fandeps we can express Cartasian for example like this:

class Category k => Cartasian k | k -> x where
  exl :: k (x a b) a
  exr :: k (x a b) b
  fork :: k a c -> k a d -> k a (x c d)

And possibly instead of -> we can use this classes in prelude too. for example

f $ a :: (a -> b) -> a -> b
f $ a :: Closed k => ((a `k` b) `k` a) `k` b -- this might be incorrect
paf31 commented 7 years ago

I would very much like to have a purescript-categories in the core library set, with, at a minimum, CCCs and symmetric and braided monoidal categories.

paf31 commented 7 years ago

But I don't think it needs to be in Prelude.

paf31 commented 7 years ago

And possibly instead of -> we can use this classes in prelude too

I don't think we should do that, since we'd need to overload lambda for it to be really useful, but I think we could consider adding some sort of category notation.

garyb commented 6 years ago

Closing this as we're not going to do it in Prelude specifically.