[Haskell-cafe] ANN: pointless fun

Joachim Breitner mail at joachim-breitner.de
Sun Jan 29 06:03:06 CET 2012


Hi,

Am Samstag, den 28.01.2012, 23:34 -0500 schrieb wren ng thornton:
> * Perhaps the most useful is that it packages up Matt Helige's classic 
> multicomposition trick[1]. These combinators allow you to easily modify 
> the types of a many-argument function with syntax that looks like giving 
> type signatures. For example,
> 
>  > foo    :: A -> B -> C
>  >
>  > albert :: A -> X
>  > beth   :: B -> Y
>  > carol  :: C -> Z
>  >
>  > bar :: X -> Y -> Z
>  > bar = foo $:: albert ~> beth ~> carol
> 
> I've found this to be especially helpful for defining non-derivable type 
> class instances for newtypes since it both abstracts away the plumbing 
> and also makes explicit what you mean.

Even without looking at the definition of $:: and ~>, I have doubts
about the existence of such a bar function (it calls foo, which needs an
A, but it is not given an A and no used function produces one; albert
only consumes one).

Maybe you mean:

        foo    :: A -> B -> C
        
        albert :: X -> A
        beth   :: Y -> B
        carol  :: C -> Z
         
        bar :: X -> Y -> Z
        bar = foo $:: albert ~> beth ~> carol

Greetings from POPL,
Joachim


-- 
Joachim "nomeata" Breitner
  mail at joachim-breitner.de  |  nomeata at debian.org  |  GPG: 0x4743206C
  xmpp: nomeata at joachim-breitner.de | http://www.joachim-breitner.de/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120129/9a19ecef/attachment-0001.pgp>


More information about the Haskell-Cafe mailing list