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
[email protected] | [email protected] | GPG: 0x4743206C
xmpp: [email protected] | http://www.joachim-breitner.de/
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
