Bulat Ziganshin wrote:
Hello Brian,
Saturday, August 19, 2006, 12:21:34 PM, you wrote:
ie putting a '.' before each field name. The intended meaning is
that dotted field names do *not* generate top level functions.
Instead they allow the compiler to generate instance decls as
follows, where we
Hello Brian,
Saturday, August 19, 2006, 12:21:34 PM, you wrote:
> ie putting a '.' before each field name. The intended meaning is that dotted
> field names do *not* generate top level functions. Instead they allow the
> compiler to generate instance decls as follows, where we've introduced a new
Brian Hulley wrote:
However I think it could be solved by a more complex desugaring:
The proposed desugarings allow us to either make all dotted fields in a
record visible, or none of them visible, but I don't think there exists a
desugaring that would allow some to be visible while others we
Ooops! ;-)
Brian Hulley wrote:
module M (Rec, use) where
import DotClasses.Dot_f-- every class has its own module (*)
data Rec' a = Rec a
newtype Rec a = Rec (Rec' a)
instance Dot__f (Rec' a) a where
instance Dot_f (Rec' a) a where
__dot_f (Rec' x) = x
Bernard James POPE wrote:
On Sat, Aug 19, 2006 at 09:21:34AM +0100, Brian Hulley wrote:
Therefore I think the desugaring would need to take place in the
compiler so the compiler could avoid exporting the
compiler-generated instances when the fields are not present in the
module export list.
I'
On Sat, Aug 19, 2006 at 09:21:34AM +0100, Brian Hulley wrote:
> Therefore I think the desugaring would need to take place in the compiler
> so the compiler could avoid exporting the compiler-generated instances when
> the fields are not present in the module export list.
I'm not entirely sure I
Brian Hulley wrote:
In the module containing the data decl for the record, the compiler
inserts the following:
instance (.x) (Vector3 a) a where
(.x) v = ... -- compiler generated code to access the field
instance (.x) (Vector3 a) a where
(.x) Vector3{.x = x} = x
Hi -
As I've been writing a Haskell program over the past few months the main
problem I encounter is that record field names are not local to the record
type, and any systematic way of making them local (eg by prepending
"_Tycon_") results in names that are just too clunky, and I feel that
ide