Refactor GHC functions