Core questions
Matthijs Kooijman
matthijs at stdin.nl
Fri Jan 30 14:55:05 EST 2009
Hi Brian,
thanks for the swift response!
> Making all GHC's datatypes Showable would probably be a nightmare. Not
I guessed as much. Thanks for confirming my suspicions :-)
> pretty printed output and using that. When you need to pull some more
> details out of a datatype just sticking random pprPanics in is a great
> debugging aid.
How would I go about this, then? You mean I can then use ppr on random places
without needing guid get the output up properly? I think I've simply used
"error" for that to the same effect, which does indeed gets the job done
(albeit slowly).
> You might be looking for isDataConId :: Id -> Bool, or
> isDataConId_maybe :: Id -> Maybe DataCon.
I didn't find this one yet, thanks.
> You might find exprIsConApp_maybe :: CoreExpr -> Maybe (DataCon,[CoreExpr])
> handy (along with isTupleCon :: DataCon -> Bool on the DataCon).
That looks exactly like what I need, thanks. I've used isTupleCon before
(working from a Type), but didn't find anything to may a CoreExpr to a
DataCon.
I'll let you know how it goes.
Gr.
Matthijs
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20090130/634f1968/attachment.bin
More information about the Glasgow-haskell-users
mailing list