Difference between revisions of "List of partial functions"

From HaskellWiki
Jump to: navigation, search
(Partial functions in Prelude: Added new section for functions that aren't even partial)
m (Added an infinity mark for functions that do not terminate given an infinite list.)
Line 1: Line 1:
 
==Partial functions in Prelude==
 
==Partial functions in Prelude==
  +
  +
NB. Functions marked with (∞) are partial because the function will not terminate if given an infinite list.
   
 
===Functions that aren't even partial===
 
===Functions that aren't even partial===
Line 14: Line 16:
 
* init
 
* init
 
* last
 
* last
* foldl
+
* foldl (∞)
* foldl'
+
* foldl' (∞)
 
* foldl1
 
* foldl1
 
* foldl1'
 
* foldl1'
Line 23: Line 25:
 
* cycle
 
* cycle
 
* !!
 
* !!
* length
+
* length (∞)
* sum
+
* sum (∞)
* product
+
* product (∞)
* reverse
+
* reverse (∞)
 
* ... (todo)
 
* ... (todo)
   
Line 50: Line 52:
   
 
* genericIndex
 
* genericIndex
* genericLength
+
* genericLength (∞)
   
 
===Data.Map===
 
===Data.Map===

Revision as of 01:13, 4 November 2015

Partial functions in Prelude

NB. Functions marked with (∞) are partial because the function will not terminate if given an infinite list.

Functions that aren't even partial

  • error
  • undefined

List functions

  • maximum
  • minimum
  • head
  • tail
  • init
  • last
  • foldl (∞)
  • foldl' (∞)
  • foldl1
  • foldl1'
  • foldr1
  • scanl1
  • scanr1
  • cycle
  •  !!
  • length (∞)
  • sum (∞)
  • product (∞)
  • reverse (∞)
  • ... (todo)

Other

  • read
  • quot
  • rem
  • quotRem
  • div
  • mod
  • divMod
  • succ
  • pred
  • toEnum
  • (^)
  • fail
  • ... (todo)

Partial functions in other base libraries

Data.List

  • genericIndex
  • genericLength (∞)

Data.Map

  • (!)

Data.Maybe

  • fromJust

Partial functions in other Haskell Platform packages

... (todo)