Labelled types question

Simon Peyton-Jones simonpj@microsoft.com
Tue, 10 Sep 2002 12:10:56 +0100


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:awfurtado@homelink.com.br]
| Sent: 09 September 2002 19:15
| To: haskell@haskell.org
| Subject: Labelled types question
|=20
| Suppose I have a labelled type 'A' defined like the following one:
|=20
| module Test (
|  A (b)
| )
|=20
| where
|=20
| data A =3D A
|  { b :: Int,
|    c :: Int
|  }
|=20
| I am exporting only 'A(b)', so why the following code "can see" 'c' ?
|=20
| module Main where
|=20
| import Test
|=20
| main :: IO ()
| main =3D print (c (A {c=3D3,b=3D2}))
|=20
| PROMPT> 3
|=20
| If Test exports only 'A', not 'A(b)', the I get the expected
compilation
| problem:
|=20
| ERROR "label.hs" (line 6): "c" is not a selector function/field name
|=20
| Am I missing something obvious here?
|=20
| Thanks,
| -- Andre
|=20
| _______________________________________________
| Haskell mailing list
| Haskell@haskell.org
| http://www.haskell.org/mailman/listinfo/haskell