From a Haskell tutorial:
We can write functions on integers by cases.
-- Compute the sum of
ghci is an interactive tool and as such allows to redefine a function when it's already be define. In your case, it doesn't see it as a two lines function definition but as two attempts of defining it. So f n = print n overrides f 0 = print 999 instead of completing it.
To enter multiple lines statement in ghci there is a special syntax. You need to do
Prelude> :{
Prelude> let foo 0 = print 999
Prelude> foo n = print n
Prelude> :}