Records in Haskell

J. Garrett Morris jgmorris at cs.pdx.edu
Fri Sep 16 09:12:41 CEST 2011


On Thu, Sep 15, 2011 at 10:46 PM, Ganesh Sittampalam <ganesh at earth.li> wrote:
> One benefit of TDNR is to replicate the discoverability of APIs that
> OO programming has - if x :: Foo then typing "x." in an IDE gives you
> a list of things you can do with a Foo. (Obviously it's not a complete
> lis for various reasons, but it does allow the author of Foo and
> others to design discoverable APIs.)
>
> So I think we'd be losing quite a bit to force f to be a record
> selector.

I'm not sure how to make update work if you allow arbitrary functions on
the RHS of a dot.  If you expose the Select and Update class, you get
some additional flexibility (i.e., the programmer can define new
selectors besides field names), but still have a chance to define
update (when it's reasonable).

 /g


-- 
"I’m surprised you haven’t got a little purple space dog, just to ram
home what an intergalactic wag you are."



More information about the Glasgow-haskell-users mailing list