toyboot4e
以下の
背景としては、以下のようにコンパイルエラーになる例を考えるつもりでした:
(f $ g) はどのように理解できますか?ghci> let f = (1 +) :: (Num a) => a -> a ghci> let g = (2 +) :: (Num a) => a -> a ghci> :t (f $ g) (f $ g) :: (Num a, Num (a -> a)) => a -> a
背景としては、以下のようにコンパイルエラーになる例を考えるつもりでした:
ghci> let a = (1 +) :: Int -> Int
ghci> let b = (2 +) :: Int -> Int
ghci> :t (a $ b)
<interactive>:1:6: error:
• Couldn't match expected type 'Int' with actual type 'Int -> Int'
• In the second argument of '($)', namely 'b'
In the expression: a $ b