Fix Issue1252: generate correct Haskell for functions with multiple clauses that are the subject of a COMPILE_EXPORT pragme

Cherry picked from 25420556a669cf900becce6f7bc6fd596c7d235f.
Fix COMPILE_EXPORT to deal with functions that are exported AND used.

Cherry picked from 2bb549e23c547e5e501e96ba866dceedc88e89b6.