Yes, they are in the global scope, and from what I gather: they are just regular functions, created by special syntax.
There are a few obvious solutions (some of which you might have thought yourself :-): - rename the accessor or the other function, or - put the data declaration or the other function in another module and import qualified, or - write a typeclass with a 'name' function and fit the non-accessor function 'name' somehow into that... I think the best approach is the modular one, but this really depends on what you are doing. -- Markus Läll On Thu, Dec 30, 2010 at 7:01 PM, Aaron Gray <[email protected]>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 > [email protected] > http://www.haskell.org/mailman/listinfo/haskell-cafe > >
_______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
