
6 Oct
2013
6 Oct
'13
10:31 p.m.
On Sun, Oct 6, 2013 at 6:54 PM, Tillmann Rendel
Hi,
Ryan Newton wrote:
It is very hard for me to see why people should be able to make their own Generic instances (that might lie about the structure of the type), in Safe-Haskell.
I guess that lying Generics instances might arise because of software evolution. Let's say we start with an abstract data type of binary trees.
Hi, A real example exists in containers for the older Data class. Data.Sequence.Seq pretends it is a list instead of a tree:
gshow (S.fromList [1,2,3] S.|> 4) "(<| (1) (<| (2) (<| (3) (<| (4) (empty)))))"
If there was a Generic instance for Seq, it would probably pretend to be a list for the same reasons the Data instance is that way. -- Adam