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 an identity to get a category #41

Closed
treeowl opened this issue Apr 8, 2016 · 6 comments · Fixed by #122
Closed

Add an identity to get a category #41

treeowl opened this issue Apr 8, 2016 · 6 comments · Fixed by #122

Comments

@treeowl
Copy link
Contributor

treeowl commented Apr 8, 2016

This might already exist somewhere, but I couldn't find it. I'm not at all committed to these names.

data Categorize s a b where
  Id :: Categorize s a a
  Embed :: s a b -> Categorize s a b

instance Semigroupoid s => Semigroupoid (Categorize s) where
  Id `o` y = y
  x `o` Id = x
  Embed x `o` Embed y = Embed (x `o` y)

instance Semigroupoid s => Category (Categorize s) where
  id = Id
  (.) = o
@treeowl
Copy link
Contributor Author

treeowl commented Apr 9, 2016

Since Option is in semigroups, I think semigroupoids is likely the right place for this thing, whatever it and its constructors should be called.

@ekmett
Copy link
Owner

ekmett commented Apr 13, 2016

I have no objection to adding such a construction in principle. Not sure about the name.

@treeowl
Copy link
Contributor Author

treeowl commented Apr 26, 2016

Do you have better names?

@treeowl
Copy link
Contributor Author

treeowl commented Aug 23, 2016

Bump! I want this for a fork of type-aligned I'm working on. Any chance you can pick a name and stick it in? Also, it supports the following eliminator, which should therefore be included.

categorize :: (a ~ b => r) -> (s a b -> r) -> Categorize s a b -> r
categorize r _ Id = r
categorize _ f (Embed x) = f x

@kozross
Copy link
Contributor

kozross commented Oct 7, 2021

@RyanGlScott I'd be happy to add this in, but the name issue never got resolved. Would Categorical suit? If so, I'd be happy to implement.

@RyanGlScott
Copy link
Collaborator

Honestly, I don't have a better name myself. Admittedly, my knowledge of category theory is pretty limited, so I'm perhaps not the best person to task with thinking of a good name for this. Ultimately, I think we have to just pick something.

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

Successfully merging a pull request may close this issue.

4 participants