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

Aaron Gray aaronngray.lists at gmail.com
Thu Dec 30 18:01:20 CET 2010


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20101230/2f74020e/attachment.htm>


More information about the Haskell-Cafe mailing list