On 2009 Mar 1, at 9:55, Manlio Perillo wrote:
Johan Tibell ha scritto:On Sun, Mar 1, 2009 at 3:07 PM, Manlio Perillo <[email protected] > wrote:Hi.Maybe I'm missing something, but I don't understand why the followingprogram: module Main where import System.IO (Handle, withFile, ReadMode)You want to import IOMode(..), not ReadMode. The latter is a data constructor of the IOMode type.However, why individual data constructors of the IOMode type are not exported?
You asked for an explicit export list, why are you surprised that things not in that export list aren't exported? If you're asking why an individual constructor needs a type with it, it's because it's only meaningful in the context of that type, if you hand the compiler ReadMode without the IOMode definition, it wouldn't be able to do anything useful with it.
(You could think if it as: ReadMode is IOMode[0] (not Haskell syntax, but internally ReadMode has the 0th constructor slot in the IOMode type), WriteMode is IOMode[1], you need IOMode for either to be useful/ meaningful.)
-- 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
PGP.sig
Description: This is a digitally signed message part
_______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
