[Haskell-beginners] Type definition doesn't match with number of arguments
andres at well-typed.com
Wed May 8 23:59:12 CEST 2013
> 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:
> type Handler r = Producer ByteString IO () -> Consumer ByteString IO () -> IO r
There you have your two extra arguments :)
Andres Löh, Haskell Consultant
Well-Typed LLP, http://www.well-typed.com
More information about the Beginners