Labelled types question

Andre W B Furtado awfurtado@homelink.com.br
Mon, 9 Sep 2002 15:15:17 -0300


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