For a class, I was trying to come up with simple examples of strict and non-strict functions, arguing that non-strict functions make sense. One of my examples was that it might be useful to define 0*x = x*0 = 0 for all x in the domain. When I got back home I naturally wanted to see what the Haskell creators think about that. Here comes my confusion.
At one machine, ghci says that multiplication is strict on both arguments:
GHCi, version 7.6.3: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> 0 * undefined
*** Exception: Prelude.undefined
Prelude> undefined * 0
*** Exception: Prelude.undefined
At another machine, ghci says that multiplication is non-strict on the first argument:
GHCi, version 7.10.3: http://www.haskell.org/ghc/ :? for help
Prelude> undefined * 0
0
Prelude> 0 * undefined
*** Exception: Prelude.undefined
What causes the difference in behaviour ?