[Haskell-cafe] Function composition

Henning Thielemann lemming at henning-thielemann.de
Tue Dec 30 18:53:03 EST 2008


On Mon, 29 Dec 2008, Martijn van Steenbergen wrote:

> Conal Elliott wrote:
>> If you think of f (here f=not) as an "semantic editor" (transformer) of 
>> values, then 'result', 'first', and 'second' are "semantic editor 
>> combinators", which can be composed together arbitrarily.  See 
>> http://conal.net/blog/semantic-editor-combinators .
>
> I recently found out Henning and Luke's Data.Accessor[1], and your editor 
> combinators and their accessors seem very much related. Was one inspired by 
> the other?
>
> Martijn.

Well spotted - thank you for pointing out this connection! Interestingly 
since Conal's approach is motivated differently, he also included 
functions. Those are missing in data-accessor, although Accessor.Container 
is close to it. The main difference is, that Conal restricts to 'modify' 
functions, and does not support 'get' like Accessors do. You can 'set' and 
'modify' all function values (or all container elements) simultaneously, 
but you can only 'get' one at a time. Thus an Accessor could only access a 
single function value, but not all of them simultaneously.


More information about the Haskell-Cafe mailing list