> It seems to me that it might be very useful for a module to export the
> pattern matching operators for a datatype without exporting the
> constructors.  Suppose we have
> 
> data A = X {a::Int, b::Float}
> 
> And we want to maintain the invariant that b is a floating-point
> representation of a.  So normally we would have to use a completely
> abstract datatype, and provide constructors and destructors.  But in
> this case, it would actually make sense to provide the 
> pattern-matching
> operator X, but not the data constructor X.  So I think it 
> would be good
> to separate these in the module export syntax.

What's wrong with

        module M (A, a, b) where { ... }

?

Simon
_______________________________________________
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to