Hi all.
I'm trying to find the point where GHC removes the function that
couldn't be executed. For example if I declare a function like:
f x = 3
f x = 5
I know that f x = 5 can0t be executed ever. The desugarer removes it,
just look the output after the desugaring phase:
Rec {
Main.f :: forall t_aOL t_aOM. (GHC.Num.Num t_aOM) => t_aOL -> t_aOM
[Exported]
[]
Main.f =
\ (@ t_aOL) (@ t_aOM) ($dNum_aOT :: {GHC.Num.Num t_aOM}) ->
__letrec {
f_aOQ :: t_aOL -> t_aOM
[]
f_aOQ = \ (x_aOF :: t_aOL) -> lit_aON;
fromInteger_aP3 :: GHC.Num.Integer -> t_aOM
[]
fromInteger_aP3 = fromInteger_aOR;
lit_aON :: t_aOM
[]
lit_aON = fromInteger_aP3 (GHC.Num.S# 3);
fromInteger_aOR :: GHC.Num.Integer -> t_aOM
[]
fromInteger_aOR = GHC.Num.fromInteger @ t_aOM $dNum_aOT;
lit_aOP :: t_aOM
[]
lit_aOP = fromInteger_aOR (GHC.Num.S# 5);
} in f_aOQ
end Rec }
after the desugarer the second function has been removed as you can see.
But where is the actual point where it does this operation? I thought
was some function in the Check.lhs file, but putting a lot of trace I
discovered this isn't the point. Someone could help me, pointing the
right function which does it?
thanks in advance,
Luca.
_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc