GHC API: getting the unfolding of a "strange" Id

Simon Peyton Jones simonpj at microsoft.com
Tue Apr 1 11:11:56 UTC 2014


These "absent" thunks appear when the strictness analyser works out that a function does not use an argument at all.  Suppose 'f' does not use its first argument. Then a call
	f (...big expression...)
will be replaced with
	f (absentError "blah")

Such thunks almost invariably turn out to be dead code in the end, and are discarded.  It's very unusual for them to survive to the end of compilation, let alone as a top-level value.  But it's not impossible.

Just for curiosity, can you compile with -dverbose-core2core, and leave the results somewhere I can see them?

In short, it doesn't look as if there is anything wrong.  If there's a good reason you want to see the unfolding anyway, that's not impossible, but at least you understand what is happening now.

Simon

| -----Original Message-----
| From: Christiaan Baaij [mailto:christiaan.baaij at gmail.com]
| Sent: 28 March 2014 09:57
| To: Simon Peyton Jones
| Cc: glasgow-haskell-users
| Subject: Re: GHC API: getting the unfolding of a "strange" Id
| 
| 
| > I don't really get why this GHC.TypeLits constraint is a bottom
| dictionary...
| > Is it because all Coercions/Constraints are bottom?
| > Is there perhaps a set of flags I can use so that I can see the Core
| term corresponding to CLaSH.Sized.Fixed.$fNumFixed2 during compilation?
| 
| 
| I guess I straight away answer my own question, sorry for the noise:
| 
| CLaSH.Sized.Fixed.$fNumFixed2
|   :: forall (n_a5SH :: GHC.TypeLits.Nat). 1 GHC.TypeLits.<= n_a5SH
| [GblId, Str=DmdType b]
| CLaSH.Sized.Fixed.$fNumFixed2 =
|   \ (@ (n_a5SH :: GHC.TypeLits.Nat)) ->
|     Control.Exception.Base.absentError
|       @ (1 GHC.TypeLits.<= n_a5SH)
|       "ww_s9JT{v} [lid] 1 base:GHC.TypeLits.<={tc r1W} n{tv a5SH} [tv]"#
| 
| I must say... I have never seen, in any of my programs, the error that
| Control.Exception.Base.absentError is supposed to give:
| absentError s = error ("Oops!  Entered absent arg " ++
| unpackCStringUtf8# s)
| 
| -- Christiaan


More information about the Glasgow-haskell-users mailing list