Use PrimMonad instead of ST in Types.hs