Conversation
|
/cc @safareli |
|
|
||
| -- | Turns a `Profunctor` into a `Invariant` functor by equating the two type | ||
| -- | arguments. | ||
| newtype Join p a = Join (p a a) |
There was a problem hiding this comment.
I wonder if it's worth providing the adjoint, which constructs a profunctor from an invariant.
There was a problem hiding this comment.
Personally, I'd rather just remove Invariant, but that's a separate, larger conversation 😄
There was a problem hiding this comment.
Wait! I just realised something, this is purescript-deprecated/purescript-monoid#34 if we provide
instance semigroupJoin :: Semigroupoid p => Semigroup (Join p a) where
append (Join a) (Join b) = Join (a <<< b)
instance monoidJoin :: Category p => Monoid (Join p a) where
mempty = Join idThere was a problem hiding this comment.
Any idea what the adjoint would look like? I just took a stab at it, but not really sure what I'm doing there and couldn't figure out how to implement dimap.
There was a problem hiding this comment.
Ah yeah! I remember now. Will add that too then.
There was a problem hiding this comment.
Feel free to give it a better name 😄
There was a problem hiding this comment.
Cojoin was all I had, I'm not sure it's any better 😆
There was a problem hiding this comment.
Split possibly? Since we're trying to split the type argument into two.
|
👍 LGTM. Curious though - is there a use case for these? |
Uhh... most of them are pretty speculative 😉 It came from a discussion with @safareli, he was asking if we could impose Then when I started on that, I figured that profunctors are still a bifunctors, just not in the purescript sense, so I went back to BF to see which of the various newtypes may translate to PF. So |
|
Do you think the names |
|
there is already Joker and Clown defined in https://pursuit.purescript.org/packages/purescript-bifunctors |
|
I'm happy to change them, just figured since they work the same way for bifunctors, reusing the names here was reasonable. |
|
There we go, |
|
|
||
| newtype Split f a b = Split (Exists (SplitF f a b)) | ||
|
|
||
| data SplitF f a b x = SplitF (a -> x) (x -> b) (f x) |
There was a problem hiding this comment.
Can we hide the constructors here?
|
👍 LGTM, thanks! |
|
I just thought - should this have reused the existing newtypes? Bit late now, but probably worth considering. |
|
I just explored that a bit...
I think next time we do breaking releases for all the core libraries we can take a look at it again though 👍 |
The name
Cowrapis probably a bit odd, but I haven't come up with anything better yet.