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

Consider different functor arguments of Ran, Lan #41

Open
Icelandjack opened this issue Aug 25, 2017 · 1 comment
Open

Consider different functor arguments of Ran, Lan #41

Icelandjack opened this issue Aug 25, 2017 · 1 comment

Comments

@Icelandjack
Copy link
Contributor

Icelandjack commented Aug 25, 2017

There is some talk on reddit if the functor arguments of Ran, Lan should be swapped, for example defining ibind and iextend for them

ibind :: (a -> Ran k j b) -> (Ran j i a -> Ran k i b)
ibind k (Ran m) = Ran (\c -> m (\a -> runRan (k a) c))

iextend :: (Lan k j a -> b) -> (Lan k i a -> Lan j i b)
iextend f (Lan h ws) = Lan (f . Lan h) ws

yields a swapped argument order from the type class

class IxApplicative m => IxMonad m where
  ibind :: (a -> m j k b) -> (m i j a -> m i k b)

class IxCopointed w => IxComonad w where
  iextend :: (w j k a -> b) -> (w i k a -> w i j b)

Thoughts?

@Icelandjack Icelandjack changed the title Functor arguments of Ran, Lan in wrong order? Consider different functor arguments of Ran, Lan Aug 26, 2017
@Icelandjack
Copy link
Contributor Author

Icelandjack commented Aug 29, 2017

A counter point is that the normal argument order allows for a Profunctor1 instance

class Profunctor1 p where
  dimap1 :: (f' ~> f) -> (g ~> g') -> (p f g ~> p f' g')

instance Profunctor1 Ran where
  dimap1 :: (f' ~> f) -> (g ~> g') -> (Ran f g ~> Ran f' g')
  dimap1 f g (Ran h) = Ran $ \i -> g (h (f . i))

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

1 participant