move some functions to ghcjs-prim