The code should not be able to see "c".  Nor the data constructor "A".
You don't say which Haskell implementation you are using.

Simon

| -----Original Message-----
| From: Andre W B Furtado [mailto:[EMAIL PROTECTED]]
| Sent: 09 September 2002 19:15
| To: [EMAIL PROTECTED]
| Subject: Labelled types question
| 
| Suppose I have a labelled type 'A' defined like the following one:
| 
| module Test (
|  A (b)
| )
| 
| where
| 
| data A = A
|  { b :: Int,
|    c :: Int
|  }
| 
| I am exporting only 'A(b)', so why the following code "can see" 'c' ?
| 
| module Main where
| 
| import Test
| 
| main :: IO ()
| main = print (c (A {c=3,b=2}))
| 
| PROMPT> 3
| 
| If Test exports only 'A', not 'A(b)', the I get the expected
compilation
| problem:
| 
| ERROR "label.hs" (line 6): "c" is not a selector function/field name
| 
| Am I missing something obvious here?
| 
| Thanks,
| -- Andre
| 
| _______________________________________________
| Haskell mailing list
| [EMAIL PROTECTED]
| http://www.haskell.org/mailman/listinfo/haskell
_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to