converted to Purescript