Need workaround for lack of fromIntegral/Int->Word rules in 7.4.2
Daniel Fischer
daniel.is.fischer at googlemail.com
Mon Dec 17 17:05:19 CET 2012
On Montag, 17. Dezember 2012, 07:07:21, Johan Tibell wrote:
> This compiles badly in 7.4.2:
>
> f :: Int -> Word
> f = fromIntegral
>
> I need a workaround.
Mine produces (with optimisations, of course)
Convert.f :: GHC.Types.Int -> GHC.Word.Word
[GblId,
Arity=1,
Caf=NoCafRefs,
Str=DmdType U(L)m,
Unf=Unf{Src=InlineStable, TopLvl=True, Arity=1, Value=True,
ConLike=True, Cheap=True, Expandable=True,
Guidance=ALWAYS_IF(unsat_ok=True,boring_ok=False)
Tmpl= \ (ds_asy [Occ=Once!] :: GHC.Types.Int) ->
case ds_asy of _ { GHC.Types.I# x#_asB [Occ=Once] ->
GHC.Word.W# (GHC.Prim.int2Word# x#_asB)
}}]
Convert.f =
\ (ds_asy :: GHC.Types.Int) ->
case ds_asy of _ { GHC.Types.I# x#_asB ->
GHC.Word.W# (GHC.Prim.int2Word# x#_asB)
}
which is what one would expect. And all of 6.12.3, 7.0.2, 7.0.4, 7.2.1, 7.2.2,
7.4.1, 7.4.2, 7.6.1 agree on that.
I think there is some context needed to nail the problem.
More information about the Glasgow-haskell-users
mailing list