# What are the differences between arrow and monads

Observe that arrow makes explicit the dependency on the input

-- Here b is the input and dependency of the computation
Arrow a b c


On the other hand monads do not have these (only the output)

Monad m a


We can observe similarities to:

Applicative f => f (a -> b)
Monad m => a -> m b


Since we have access to the input, we can modify the control flow itself:

class Category y => Arrow y where
-- Minimal implementation: arr and first
arr    :: (a -> b) -> y a b                 -- converts function to arrow

-- These functions modify the computation flow
first  :: y a b -> y (a, c) (b, c)          -- maps over first component
second :: y a b -> y (c, a) (c, b)          -- maps over second component
(***)  :: y a c -> y b d -> y (a, b) (c, d) -- first and second combined
(&&&)  :: y a b -> y a c -> y a (b, c)      -- (***) on a duplicated value