[Haskell-cafe] Basic question....
rodrigo.bonifacio at uol.com.br
Fri Aug 17 09:11:21 EDT 2007
I want to create the following polymorphic type (EnvItem) that we can apply two functions (envKey and envValue). I tried the following:
> type Key = String
> data EnvItem a = EnvItem (Key, a)
> envKey :: EnvItem (Key, a) -> String
> envKey EnvItem (key, value) = key
> envValue :: EnvValue(Key, a) -> a
> envValue EnvItem (key, value) = value
But this is resulting in the error: [Constructor "EnvItem" must have exactly 1 argument in pattern]
I think this is a very basic problem, but I don't know what is wrong.
More information about the Haskell-Cafe