I am currently experimenting with data types, and I ran into a problem with multiple data constructor declarations.
data DBPosition = Unknown
| Omega Integer
| Delta Integer
deriving (Show, Eq, Ord)
data DBGeometry = Unknown | Cis | Trans
deriving (Show, Eq, Ord)
data DoubleBond = DoubleBond DBPosition DBGeometry
deriving (Show, Eq, Ord)
If I needed to make such a value - let bond = DoubleBond Unknown Unknownthen it would be possible to assume that the first Unknownis of type DBPositionand the second Unknownis of type DBPosition. Unfortunately, this is not the case:
test.hs:6:27:
Multiple declarations of `Unknown'
Declared at: test.hs:1:27
test.hs:6:27
Failed, modules loaded: none.
Are there any language extensions that can be used to get around this?
source
share