-- Haskell
unit :: Foo a (a, ())
unit = Foo f g where
f x = Just (x, ())
g (x, ()) = Just x

-- PureScript
-- Could not match type Foo t2 (Tuple t2 Unit) with type Unit
unit :: forall a. Foo a (Tuple a Unit)
unit = Foo f g
where
f x = Just (Tuple x unit)
g (Tuple x y)
| y == unit = Just x
| otherwise = Nothing

The problem here is your unit definition is shadowing the normal unit, so when you say:

f x = Just (Tuple x unit)

The unit there is not the inhabitant of Unit, it’s the function again. If you rename the function you’re defining to unit' or foonit or whatever it works fine