Send Beginners mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1.  Type definition doesn't match with number of     arguments
      (Emanuel Koczwara)
   2. Re:  Type definition doesn't match with number    of arguments
      (Andres L?h)


----------------------------------------------------------------------

Message: 1
Date: Wed, 08 May 2013 23:05:47 +0200
From: Emanuel Koczwara <[email protected]>
Subject: [Haskell-beginners] Type definition doesn't match with number
        of      arguments
To: [email protected]
Message-ID: <1368047147.10660.7.camel@emanuel-laptop>
Content-Type: text/plain; charset="UTF-8"

Hi,

  Please help me understund this code:

http://hackage.haskell.org/packages/archive/daemons/0.1.2/doc/html/src/Control-Pipe-C3.html#commandSender

  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?

Emanuel





------------------------------

Message: 2
Date: Wed, 8 May 2013 23:59:12 +0200
From: Andres L?h <[email protected]>
Subject: Re: [Haskell-beginners] Type definition doesn't match with
        number  of arguments
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Message-ID:
        <CALjd_v5o=yrQYzXC4iELkGgooz9GU+cZWt=6crz0rqafqyl...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

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



------------------------------

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 59, Issue 7
****************************************

Reply via email to