Hi Gabriel,

That's what I thought, but when I do that I get this error on the line of
the type synonym (copied just as above):

    Type synonym ‘Parser’ should have 3 arguments, but has been given 2

    In the type declaration for ‘ServerState’


Regards.


On Wed, Jul 2, 2014 at 4:02 PM, Gabriel Gonzalez <[email protected]>
wrote:

>  You were on the right track with your first approach.  The only issue is
> that Haskell requires that all type synonyms are fully saturated.  You
> defined your type synonym to take two parameters, `m` and `r`, so Haskell
> complained when you only partially applied it to just `m` in the type for
> `processHandshake`.
>
> Fortunately, the solution is really simple: just leave out the `r` in the
> definition of `ServerState`:
>
>     type ServerState m = Parser ByteString (ErrorT ServerPipelineException
> m)
>
> That's equivalent, but more generally useful, since you can now apply it
> to only `m`.
>
> This is also the same reason that `pipes` defines `Producer` like this:
>
>     type Producer b = Proxy X () () b
>
> ... and not like this:
>
>     type Producer b m r = Proxy X () () b m r
>
> On 7/1/14, 10:46 PM, Kyle Van Berendonck wrote:
>
> Hi,
>
>  I'm using mtl and pipes-parse.
>
>  I have the following:
>
>
>> type ServerState m r = Parser ByteString (ErrorT ServerPipelineException
>> m) r
>
>
>  When I try and put it in a pipe though, like so:
>
>  processHandshake :: Monad m => Pipe InboundPacketHandshake
>> OutboundPacketHandshake (ServerState m) ()
>
>
>  I get this error:
>
>      Type synonym ‘ServerState’ should have 2 arguments, but has been
>> given 1
>>     In the type signature for ‘processHandshake’:
>>       processHandshake :: Monad m =>
>>                           Pipe InboundPacketHandshake
>> OutboundPacketHandshake (ServerState m) ()
>
>
>  But, if I bring the () inside the ServerState, I get:
>
>      The third argument of ‘Pipe’ should have kind ‘* -> *’,
>>       but ‘ServerState m ()’ has kind ‘*’
>>     In the type signature for ‘processHandshake’:
>>       processHandshake :: Monad m =>
>>                           Pipe InboundPacketHandshake
>> OutboundPacketHandshake (ServerState m ())
>
>
>  I'm confused. How do I layer arbitrary numbers of transformers inside
> pipes?
>
>  --
> 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