[Haskell-beginners] Type definition doesn't match with number of arguments
Andres Löh
andres at well-typed.com
Wed May 8 23:59:12 CEST 2013
Hi.
> The type of commandSender is:
>
> (Serialize a, Serialize b) => a -> Handler (Maybe b)
>
> But definition looks like this:
>
> commandSender command reader writer = do ...
>
> As I understund, command has type a and this function returns Handler
> (Maybe b). reader and writer doesn't fit here. What's going on?
Well, given this definition of commandSender taking three arguments,
Handler must be a type synonym for a function type. Let's verify that:
http://hackage.haskell.org/packages/archive/daemons/0.1.2/doc/html/Control-Pipe-Socket.html#t:Handler
says:
> type Handler r = Producer ByteString IO () -> Consumer ByteString IO () -> IO r
There you have your two extra arguments :)
Cheers,
Andres
--
Andres Löh, Haskell Consultant
Well-Typed LLP, http://www.well-typed.com
More information about the Beginners
mailing list