[Haskell-cafe] Chuch encoding of data structures in Haskell

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Thu May 27 19:07:24 EDT 2010


On May 27, 2010, at 13:44 , Günther Schmidt wrote:
> The approach is so simple and trivial that it must have occurred to  
> people a hundred times over. Yet I do not find any other examples of  
> this. Whenever I google for church encoding the examples don't go  
> beyond church numerals.


Hm.  If I reorder your (.+.) slightly and reparenthesize:

reordered_cons  :: (t -> (t1 -> t2)) -> t -> (t1 -> t2)
churchedNumeral :: (t -> t         ) -> t -> t

t unifies with (t1 -> t2), giving us a Church numeral made up of  
(t1,t2).  (I think.)

-- 
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH


-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20100527/a91c7773/PGP.bin


More information about the Haskell-Cafe mailing list