Skip to content

mkWorkerArgs test is back to front

Consider this

f :: Int -> Int#
f x = f (x+1)

and compile with ghc -O -ffun-to-thunk -dcore-lint. We get

*** Core Lint errors : in result of Worker Wrapper binds ***
Foo.hs:7:1: warning:
    The type of this binder is unlifted: $wf_szB
    Binder's type: Int#
    In the RHS of $wf_szB :: Int#
    Substitution: [TCvSubst
                     In scope: InScope {}
                     Type env: []
                     Co env: []]
*** Offending Program ***
Rec {
$wf_szB [InlPrag=[2], Occ=LoopBreaker] :: Int#
[LclId, Str=b]
$wf_szB
  = let {
      w_szz [Dmd=B] :: Int
      [LclId]
      w_szz = RUBBISH[LiftedRep] @Int } in
    let {
      x_aw8 [Dmd=B] :: Int
      [LclId]
      x_aw8 = w_szz } in
    f (case x_aw8 of { I# x_azu [Dmd=A] -> I# (+# x_azu 1#) })

f [InlPrag=[2]] :: Int -> Int#
[LclIdX,
 Arity=1,
 Str=<B>b,
 Cpr=b,
 Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True,
         WorkFree=True, Expandable=True,
         Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=False)
         Tmpl= \ _ [Occ=Dead, Dmd=B] -> $wf_szB}]
f = \ (w_szz [Dmd=B] :: Int) -> $wf_szB
end Rec }
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information