[Haskell-beginners] Can i define a record without defining access method.

Brandon Allbery allbery.b at gmail.com
Sat Jul 9 20:28:35 CEST 2011


On Sat, Jul 9, 2011 at 12:41, yi huang <yi.codeplayer at gmail.com> wrote:
> On Sun, Jul 10, 2011 at 12:25 AM, Chaddaï Fouché <chaddai.fouche at gmail.com>
> wrote:

>> conflicting function name. Here I guess "id" is the big problem since
>> it comes with the prelude you'll have to use the NoImplicitPrelude
>> extension and explicitly "import Prelude hiding (id)", I suggest you

If the first thing you do is "import Prelude ...", you shouldn't need
the extension, IIRC?  (Doesn't the Report spec that?)

> Sorry i don't describe my problem well, actually i have two records, Request
> and Response, some attributes have same names, e.g. version, id.

If they always have the same types (that is, "version" isn't an Int in
one and String in another) then the -XDisambiguateRecordFields
extension will help.

-- 
brandon s allbery                                      allbery.b at gmail.com
wandering unix systems administrator (available)     (412) 475-9364 vm/sms



More information about the Beginners mailing list