Comment

Comment by DannoHung

This is why I hate C++

    template<template<class> class f1, template<class> class f2> struct or_combinator
Incidentally, his or_combinator example is more simply expressed thusly:

    or_combinator f1 f2 x = (f1 x) || (f2 x)
This has the same type signature. Anonymous functions are more useful in Haskell when you have some lexical context which needs to be captured and passed around. If partial application suffices, simply use partial application.

I suppose he was trying to demonstrate that the evaluation does not occur until the value is applied though, if the audience was more familiar with C++.

parent DannoHung 16 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton