> > Put the data declaration in a module, export the type, but > > not the constructor you want to hide: > > > module Shape (Shape(Square), circle) where > > Since we were talking about 'what can one do with a constructor as compared > with a function', it should be mentioned that this also has a disadvantage: > you loose pattern matching outside the module. I.e. no longer can say [..] > BTW, would it be possible (in principle) to allow constructor export > 'read-only', so matching against a constructor is allowed but not > constructing a value?
OCaml has this: http://caml.inria.fr/ocaml/htmlman/manual021.html#htoc99 --KW 8-) -- Keith Wansbrough <[EMAIL PROTECTED]> http://www.cl.cam.ac.uk/users/kw217/ University of Cambridge Computer Laboratory. _______________________________________________ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe
