[Haskell] Per-type function namespaces (was: Data.Set whishes)

Andreas Rossberg rossberg at ps.uni-sb.de
Thu Mar 4 11:28:43 EST 2004


Simon Peyton-Jones wrote:
> 
> | Actually, #l is just syntactic sugar for (\{l=x,...}->x), which
> implies
> | that you might need type annotations.
> 
> Yes I was wrong to say that there are no implicitly-defined record
> selectors; (#l r) is exactly that.  Syntactically I'd prefer (r.l); but
> regardless, it's a syntactic construct distinct from function
> application, which must be monomorphic.

I'm not sure I parsed your sentence correctly, but in SML, (#l r) indeed 
*is* a function application, and #l is a perfectly normal function, as 
its desugared form reveals. It just fails to have a principal type (due 
to the lack of row polymorphism), so its type must be derivable from 
context - which might involve a type annotation.

BTW, I'd prefer r.l as well. A section like (.l) could then give you the 
equivalent of #l.

	- Andreas

-- 
Andreas Rossberg, rossberg at ps.uni-sb.de

Let's get rid of those possible thingies!  -- TB



More information about the Haskell mailing list