[Haskell-cafe] Label macro expansion bug In HList.

aditya siram aditya.siram at gmail.com
Tue Nov 8 17:13:48 CET 2011

Hi all,
I am exploring OOHaskell and ran into some compilation issues with some of
the samples. I hope this is the right place to report it.

For example "OCamlTutorial.hs" generates the following error:
    Multiple declarations of `foo'
    Declared at: ../samples/OCamlTutorial.hs:54:1
Failed, modules loaded: OOHaskell, Dynamic, Print, DeepNarrow, Nominal, New.

This is happening because the "label" macro on line 98:
$(label "varX")
doesn't expand correctly and clashes with the "foo" function on line 54:
foo f = f # field1

The "label" function is found in the Data.HList.MakeLabels module and
should work this way according to the docs:
> runQ (label "test") >>= putStrLn . pprint
data Test deriving (Data.Typeable.Internal.Typeable)
test = Data.HList.FakePrelude.proxy :: Data.HList.FakePrelude.Proxy Test

But I get:
data Foo_0 deriving (Data.Typeable.Internal.Typeable)
foo_1 = Data.HList.FakePrelude.proxy :: Data.HList.FakePrelude.Proxy Foo_0

This still doesn't cleanly explain why "OCamlTutorial.hs" is failing since
it seems to be generating unique datatypes and functions by suffixing them
with a number, but it seems to point to the problem. I'm hoping someone who
knows HList better might understand it better.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20111108/407edb8d/attachment.htm>

More information about the Haskell-Cafe mailing list