Why is Bag's Data instance "broken"?

José Pedro Magalhães jpm at cs.uu.nl
Fri Sep 21 10:04:13 CEST 2012


I've now added a dataCast1 method to this instance in HEAD; casting should
now work as expected.


Cheers,
Pedro

On Thu, Sep 20, 2012 at 11:12 AM, Philip Holzenspies
<pkfh at st-andrews.ac.uk>wrote:

>  On 20 Sep 2012, at 09:40, José Pedro Magalhães wrote:
>
>   instance Data a => Data (Bag a) where
>>   gfoldl k z b = z listToBag `k` bagToList b -- traverse abstract type
>> abstractly
>>   toConstr _   = abstractConstr $ "Bag("++show (typeOf
>> (undefined::a))++")"
>>   gunfold _ _  = error "gunfold"
>>   dataTypeOf _ = mkNoRepType "Bag"
>>
>
> Btw, where is this instance defined?
>
>
> GHCROOT/compiler/utils/Bag.lhs, lines 266-270 (current git-repo HEAD and
> many versions previously).
>
>  Ph.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20120921/23142a6d/attachment.htm>


More information about the Glasgow-haskell-users mailing list