pseudo-function

From HaskellWiki
(Redirected from Unsafe functions)

Ever since McCarthy referred to the I/O operations in LISP 1.5 as "pseudo-functions" functional I/O has been viewed with suspicion.

Functional Programming and Input/Output, Andrew D. Gordon (page 146 of 168).

A pseudo-function (or faux-function) only resembles a Haskell function - they usually have none of the benefits normally associated with functions in Haskell, such as simpler equational reasoning and parallelism. But worst of all, the use of pseudo-functions in a Haskell program means the types of its expressions, inferred or declared, can no longer be relied on (for example, to show where externally visible side effects are being used).

To then find a bug would involve a slow and laborious manual search through most, if not all of the program's sources, along with that of any libraries it relies on: not a practical option for codebases containing many million lines of source code.

The use of pseudo-functions in Haskell should therefore be extensively documented (in particular, why they're being used at all), or be completely avoided.


A rogues' gallery

These are just some of the pseudo-functions lurking in Haskell libraries:

See also