[Haskell-cafe] "record" types and unique names

Aaron Gray aaronngray.lists at gmail.com
Thu Dec 30 18:57:58 CET 2010


On 30 December 2010 17:29, aditya siram <aditya.siram at gmail.com> wrote:

> I don't think record field disambiguation what you're after. My apologies.
> -deech


Interesting never the less.

Thanks,

Aaron


>  On Thu, Dec 30, 2010 at 11:20 AM, aditya siram <aditya.siram at gmail.com>
> wrote:
> > Take a look at the record field disambiguation [1] extension to GHC.
> > It sounds like what you're looking for.
> > -deech
> > [1]
> http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/syntax-extns.html#disambiguate-fields
> >
> > On Thu, Dec 30, 2010 at 11:01 AM, Aaron Gray <aaronngray.lists at gmail.com>
> wrote:
> >> Given a Haskell "record type" :-
> >>     data Test
> >>         = Test {
> >>             name :: String,
> >>             value :: Int
> >>         }
> >>     test = Test {
> >>             name = "test",
> >>     value = 1
> >>         }
> >>     main :: IO ()
> >>     main = do
> >>         putStrLn (name test)
> >> Are "name" and "value" in the global name space, as the following gives
> an
> >> error "Multiple declarations of `name'" :-
> >>     name :: String -> String
> >>     name s = s
> >> Is there any way round this ?
> >> Many thanks in advance,
> >> Aaron
> >>
> >> _______________________________________________
> >> Haskell-Cafe mailing list
> >> Haskell-Cafe at haskell.org
> >> http://www.haskell.org/mailman/listinfo/haskell-cafe
> >>
> >>
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20101230/ea705bc3/attachment.htm>


More information about the Haskell-Cafe mailing list