News for hackers. Stuff that matters.
Re:Haskell: The Bad Parts, part 2 (2020) by wetmore on Tuesday February 09, 2021 @11:05AM (#26079082)
Not exactly, partial functions can be surjective, eg

f :: Int -> Bool

f 0 = True

f 1 = False

f n = f (n + 1)

is surjective onto Bool but also partial (doesn't return for n > 1). In Haskell we say that when a function doesn't return, the output is bottom, written as ⊥.

You could say that a function f : A -> B is partial if f^{-1}(B \ ⊥) is surjective.

There are no comments on this comment yet.