category-theory

Is it possible to write join down for Arrows, not ArrowApply?

断了今生、忘了曾经 提交于 2020-08-19 07:29:36
问题 I tried writing down joinArr :: ??? a => a r (a r b) -> a r b . I came up with a solution which uses app , therefore narrowing the a down to ArrowApply 's: joinArr :: ArrowApply a => a r (a r b) -> a r b joinArr g = g &&& Control.Category.id >>> app Is it possible to have this function written down for arrows? My guess is no. Control.Monad.join could have been a good stand-in for >>= in the definition of the Monad type class: m >>= k = join $ k <$> m . Having joinArr :: Arrow a => a r (a r b)

Why do Static Arrows generalise Arrows?

自古美人都是妖i 提交于 2020-07-18 18:49:49
问题 It is widely known that Applicative generalises Arrows . In the Idioms are oblivious, arrows are meticulous, monads are promiscuous paper by Sam Lindley, Philip Wadler and Jeremy Yallop it is said that Applicative is equivalent to Static Arrows, that is arrows for which the following isomorphism holds: arr a b :<->: arr () (a -> b) As far as I can understand, it could be illustrated the following way: Note: newtype Identity a = Id { runId :: a } . Klesli Identity is a Static Arrow as it wraps

Is every Alternative Monad Filterable?

余生颓废 提交于 2020-04-10 08:06:08
问题 The category of sets is both cartesian monoidal and cocartesian monoidal. The types of the canonical isomorphisms witnessing these two monoidal structures are listed below: type x + y = Either x y type x × y = (x, y) data Iso a b = Iso { fwd :: a -> b, bwd :: b -> a } eassoc :: Iso ((x + y) + z) (x + (y + z)) elunit :: Iso (Void + x) x erunit :: Iso (x + Void) x tassoc :: Iso ((x × y) × z) (x × (y × z)) tlunit :: Iso (() × x) x trunit :: Iso (x × ()) x For the purposes of this question I

Is every Alternative Monad Filterable?

谁说胖子不能爱 提交于 2020-04-10 08:06:08
问题 The category of sets is both cartesian monoidal and cocartesian monoidal. The types of the canonical isomorphisms witnessing these two monoidal structures are listed below: type x + y = Either x y type x × y = (x, y) data Iso a b = Iso { fwd :: a -> b, bwd :: b -> a } eassoc :: Iso ((x + y) + z) (x + (y + z)) elunit :: Iso (Void + x) x erunit :: Iso (x + Void) x tassoc :: Iso ((x × y) × z) (x × (y × z)) tlunit :: Iso (() × x) x trunit :: Iso (x × ()) x For the purposes of this question I

Is every Alternative Monad Filterable?

|▌冷眼眸甩不掉的悲伤 提交于 2020-04-10 08:05:27
问题 The category of sets is both cartesian monoidal and cocartesian monoidal. The types of the canonical isomorphisms witnessing these two monoidal structures are listed below: type x + y = Either x y type x × y = (x, y) data Iso a b = Iso { fwd :: a -> b, bwd :: b -> a } eassoc :: Iso ((x + y) + z) (x + (y + z)) elunit :: Iso (Void + x) x erunit :: Iso (x + Void) x tassoc :: Iso ((x × y) × z) (x × (y × z)) tlunit :: Iso (() × x) x trunit :: Iso (x × ()) x For the purposes of this question I