Broken Data.Data instances
p.k.f.holzenspies at utwente.nl
p.k.f.holzenspies at utwente.nl
Thu Jul 24 15:42:19 UTC 2014
Dear GHC-ers,
Is there a reason for explicitly broken Data.Data instances? Case in point:
> instance Data Var where
> -- don't traverse?
> toConstr _ = abstractConstr "Var"
> gunfold _ _ = error "gunfold"
> dataTypeOf _ = mkNoRepType "Var"
I understand (vaguely) arguments about abstract data types, but this also excludes convenient queries that can, e.g. extract all types from a CoreExpr. I had hoped to do stuff like this:
> collect :: (Typeable b, Data a, MonadPlus m) => a -> m b
> collect = everything mplus $ mkQ mzero return
>
> allTypes :: CoreExpr -> [Type]
> allTypes = collect
Especially when still exploring (parts of) the GHC API, being able to extract things in this fashion is very helpful. SYB's "everything" being broken by these instances, not so much.
Would a patch "fixing" these instances be acceptable?
Regards,
Philip
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20140724/cbca36d4/attachment.html>
More information about the ghc-devs
mailing list