ここまでのまとめ:ライブラリ関数

ここまで教科書に出てきたライブラリ関数(演算子も含める)をまとめてみる。 教科書の付録Aにはもっと多くの関数が載っている。(付録Aを読んでみたら、ガードのotherwiseはキーワードではなくTrueと評価される定数だった。新しい発見。)

  • (+) :: Num a => a -> a -> a
  • (-) :: Num a => a -> a -> a
  • (*) :: Num a => a -> a -> a
  • negate :: Num a => a -> a
  • abs :: Num a => a -> a
  • signum :: Num a => a -> a
  • mod :: Integral a => a -> a -> a
  • div :: Integral a => a -> a -> a
  • even :: Integral a => a -> Bool
  • odd :: Integral a => a -> Bool
  • (/) :: Fractional a => a -> a -> a
  • recip :: Fractional a => a -> a
  • (^) :: (Num a, Integral b) => a -> b -> a
  • sum :: Num a => [a] -> a
  • product :: Num a => [a] -> a
  • (++) :: [a] -> [a] -> [a]
  • head :: [a] -> a
  • tail :: [a] -> [a]
  • (!!) :: [a] -> Int -> a
  • take :: Int -> [a] -> [a]
  • drop :: Int -> [a] -> [a]
  • length :: [a] -> Int
  • null :: [a] -> Bool
  • reverse :: [a] -> [a]
  • init :: [a] -> [a]
  • not :: Bool -> Bool
  • (&&) :: Bool -> Bool -> Bool
  • (||) :: Bool -> Bool -> Bool
  • fst :: (a,b) -> a
  • snd :: (a,b) -> b
  • zip :: [a] -> [b] -> [(a,b)]
  • splitAt :: Int -> [a] -> ([a],[a])
  • (:) :: a -> [a] -> [a]
  • id :: a -> a
  • (==) :: Eq a => a -> a -> Bool
  • (/=) :: Eq a => a -> a -> Bool
  • (<) :: Ord a => a -> a -> Bool
  • (<=) :: Ord a => a -> a -> Bool
  • (>) :: Ord a => a -> a -> Bool
  • (>=) :: Ord a => a -> a -> Bool
  • min :: Ord a => a -> a -> a
  • max :: Ord a => a -> a -> a
  • show :: Show a => a -> String
  • read :: Read a => String -> a
  • const :: a -> b -> a
  • map :: (a -> b) -> [a] -> [b]
  • and :: [Bool] -> Bool
  • or :: [Bool] -> Bool
  • concat :: [ [a] ] -> [a]
  • fromIntegral :: (Integral a, Num b) => a -> b
  • replicate :: Int -> a -> [a]

Data.Char

  • ord :: Char -> Int
  • chr :: Int -> Char
  • isDigit :: Char -> Bool
  • isLower :: Char -> Bool
  • isUpper :: Char -> Bool
  • toLower :: Char -> Char
  • toUpper :: Char -> Char