[Haskell-beginners] Multiple declarations of value constructor

Emanuel Koczwara poczta at emanuelkoczwara.pl
Wed Dec 19 16:52:38 CET 2012


Hi,

-- tests.hs
data MyType1 = Value1 | Value2
data MyType2 = Value1 | Value2


Prelude> :l tests
[1 of 1] Compiling Main             ( tests.hs, interpreted )

tests.hs:3:16:
    Multiple declarations of `Main.Value1'
    Declared at: tests.hs:1:16
                 tests.hs:3:16

tests.hs:3:25:
    Multiple declarations of `Main.Value2'
    Declared at: tests.hs:1:25
                 tests.hs:3:25
Failed, modules loaded: none.

If so, how are numbers defined? I can use 1 :: Int or 1 :: Integer. Why not Value1 :: MyType1 and Value1 :: MyType2?

Emanuel






More information about the Beginners mailing list