
Yes, surely toConstr should have consistent behaviour on tuples and other single-constructor types. I'm inclined to agree that it should be strict in all cases, and I'll fix Data.Generics.Instances to make it so. Unless someone yells otherwise. Simon | -----Original Message----- | From: libraries-bounces@haskell.org [mailto:libraries-bounces@haskell.org] On Behalf Of Nils Anders | Danielsson | Sent: 02 June 2005 15:43 | To: libraries@haskell.org | Subject: Inconsistent strictness of Data.Generics.toConstr | | Data.Generics.toConstr is non-strict at the unit type (), but the | version derived (under GHC 6.4) for isomorphic types, such as One | below, is strict. | | data One = One deriving (Typeable, Data) | | > toConstr (undefined :: ()) | () | > toConstr (undefined :: One) | *** Exception: Prelude.undefined | | Furthermore toConstr is non-strict for a bunch of other types, see | Data.Generics.Instances. To me it seems reasonable that toConstr | should be strict, since bottom is not a constructor. | | (I'm not just nit-picking, a bug in one of my programs was caused by | me thinking toConstr was strict. The bug was of course easily fixed by | adding a seq, but I'd prefer consistent behaviour of toConstr.) | | -- | /NAD | | _______________________________________________ | Libraries mailing list | Libraries@haskell.org | http://www.haskell.org/mailman/listinfo/libraries