This exists purely to avoid `(Functor m, Monad m)` constraints. When the AMP (Applicative Monad Proposal) hits Debian Stable then I will switch to the `Functor m` constraint.

On 02/12/2014 09:42 PM, Ein Brown wrote:
Apparently the Monad instance for Proxy only requires a Functor m constraint:

bind'
    :: Functor m
    => Proxy a' a b' b m r
    -> (r -> Proxy a' a b' b m r')
    -> Proxy a' a b' b m r'
bind' p f = go p where
    go p = case p of
        Request a' k -> Request a' (go . k)
        Respond b  k -> Respond b  (go . k)
        M          m -> M $ fmap go m
        Pure    r    -> f r

I didn't find a discussion of this in my search, but if it is correct I could imagine it has been noticed before.

When I was reading the definition of Proxy the 'Monad m' constraint seemed odd. At first, the 'Monad m' constraint felt right since Proxy is acting like a monad transformer over 'm'. But the "M" constructor means each step of a Pipe computation may or may not involve an effect 'm', and in fact a single "Pure" step does not. You can contrast this with something like FreeT where every level of the FreeT type gets wrapped by 'm'. Just writing the type of 'join' for FreeT makes it clear you need the type constructor 'm' to admit 'join' too. But the type of 'join' for Proxy clearly doesn't need this.
--
You received this message because you are subscribed to the Google Groups "Haskell Pipes" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].

--
You received this message because you are subscribed to the Google Groups "Haskell 
Pipes" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].

Reply via email to