
On Mon, Dec 2, 2013 at 3:00 PM, Richard Eisenberg
Hi John,
Good questions!
On Nov 27, 2013, at 3:35 PM, John Lato wrote:
Consider data V a = V Int (ForeignPtr a), a storable vector, where the Int is the number of elements. We would then want to add 'type role V nominal' as the stored data depends on the Storable instance for the 'a' parameter. Is this correct?
If you want to be fully safe in the presence of different Storable dictionaries for Age and Int, yes, you should declare `a` to be nominal. However, it's much more likely that Age and Int have the same implementation for Storable, and it might be much more convenient for your users to be able to freely convert between `V Age` and `V Int`. I would say that this is a judgment call -- nominal is safer (always), but representational may be more practical.
For the record, I use newtypes to pick out different Storable instances rather a lot, and would find it awfully inconvenient if library authors started assuming otherwise. Anthony