[Haskell-cafe] Re: The Worker/Wrapper Transformation

Achim Schneider barsoap at web.de
Thu Jan 3 07:34:26 EST 2008


Achim Schneider <barsoap at web.de> wrote:

> "Brent Yorgey" <byorgey at gmail.com> wrote:
> 
> > 
> > Well, (:) has type a -> [a] -> [a], so a function corresponding to
> > (:) for Hughes lists should have type
> > 
> > foo :: a -> H a -> H a
> > 
> > [...]
> > I think the key sentence from the paper is this: "by
> > representing a list xs as the function (xs ++) that appends this
> > list to another list that has still to be supplied."  If you
> > understand that sentence, then you can understand why [] is id and
> > (++) is (.).
> > 
> Yes, I did.
> 
> They key was not thinking that : has type
> 
> (:) :: a -> a -> [a]
> 
> , or, put differently, beat the lisp out of me, thanks.
> 
What the hell am I talking about?

(define (cons x y)
   (lambda (m) (m x y)))
 
(define (car z)
   (z (lambda (p q) p)))

(define (cdr z)
   (z (lambda (p q) q)))

: is, in a sense, \.

-- 
(c) this sig last receiving data processing entity. Inspect headers for
past copyright information. All rights reserved. Unauthorised copying,
hiring, renting, public performance and/or broadcasting of this
signature prohibited. 



More information about the Haskell-Cafe mailing list