[Haskell-beginners] definition of combinator

Michael Mossey mpm at alumni.caltech.edu
Mon Aug 24 13:45:06 EDT 2009



Brandon S. Allbery KF8NH wrote:
> On Aug 23, 2009, at 20:44 , Michael Mossey wrote:
>> Although I can use libraries like Parsec, I don't really understand 
>> what a combinator is, theoretically. There is an article here
> 
> 
> Example:  in Parsec, "many" is a combinator which takes a parser as an 
> argument and produces a parser that matches multiple successive copies 
> of whatever the argument matches.  It doesn't need to know anything 
> about its argument except that it's a parser.  This kind of function 
> lets you build up complex but general parsers from smaller pieces.
> 

What makes it a "combinator" and not a general function? The fact that it 
takes only a function (parser) as input (no data) and produces only a 
function? Is any function that takes only functions and produces a function 
called a combinator?

Thanks,
Mike



More information about the Beginners mailing list