📜  haskell 任意函数 - Haskell 代码示例

📅  最后修改于: 2022-03-11 14:53:35.049000             🧑  作者: Mango

代码示例1
{-
  One expression of the belief is “everything is a function” in Haskell. ... 
  A recurring answer is that such things are “functions of no arguments” or 
  functions of a one-element type or “constant functions”.
-}

-- A sample function
factorial :: (Integral a) => a -> a  
factorial 0 = 1  
factorial n = n * factorial (n - 1)