[Haskell-cafe] Re: Polymorphic record field?

2010-09-26 Thread Kevin Jardine
OK, thanks for this advice. The type definition compiles, but when I try to actually access myField, the compiler says: Cannot use record selector `myField' as a function due to escaped type variables Probable fix: use pattern-matching syntax instead So I took the hint and wrote a new

[Haskell-cafe] Re: Polymorphic record field?

2010-09-26 Thread Kevin Jardine
OK, I have a solution. Ugly, but it compiles. MyStruct actually has quite a few fields but I only need to access the polymorphic field 4 times. So for the functions that needed that I wrote: f myS@(MyStruct value _ _ _ ) and then could use value. I could then use the usual record accessors on

Re: [Haskell-cafe] Re: Polymorphic record field?

2010-09-26 Thread Daniel Fischer
On Sunday 26 September 2010 14:00:38, Kevin Jardine wrote: OK, thanks for this advice. The type definition compiles, but when I try to actually access myField, the compiler says: Cannot use record selector `myField' as a function due to escaped type variables Probable fix: use

Re: [Haskell-cafe] Re: Polymorphic record field?

2010-09-26 Thread Michael Snoyman
How about f myS@(MyStruct { myField = value }) ? On Sun, Sep 26, 2010 at 2:14 PM, Kevin Jardine kevinjard...@gmail.com wrote: OK, I have a solution. Ugly, but it compiles. MyStruct actually has quite a few fields but I only need to access the polymorphic field 4 times. So for the

[Haskell-cafe] Re: Polymorphic record field?

2010-09-26 Thread Kevin Jardine
Hi Michael, Yes, that does compile! Much less ugly and does not expose the internal bits of MyStruct. Thanks. Kevin On Sep 26, 2:26 pm, Michael Snoyman mich...@snoyman.com wrote: How about f myS@(MyStruct { myField = value }) ? On Sun, Sep 26, 2010 at 2:14 PM, Kevin Jardine