On Aug 17, 2007, at 9:11 , rodrigo.bonifacio wrote:

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]

You need to parenthesize the constructor.

envValue (EnvItem (_,value)) = value

(The _ indicates that you're not using that item, rather than giving it a name that won't be used.)

Why do you need to do this? Because you can pass functions around, and a constructor is a function. But your type says you don't want a bare function there, so the compiler complains.

--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED]
system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED]
electrical and computer engineering, carnegie mellon university    KF8NH


_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to