Skip to content

Commit dce1878

Browse files
committed
Complete the explanation of the section of minus -
1 parent 70a64b2 commit dce1878

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

assets/18.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -639,17 +639,18 @@ ghci> :t (- 4)
639639
(- 4) :: Num a => a
640640
```
641641

642-
hoge
642+
一方、`-`の左辺に`4`を書いた場合、問題なく「`-`演算子のセクション」が作れます。「4引く関数」ではなく「4から受け取った値を引く関数」が出来上がります:
643643

644644
```haskell
645645
ghci> :t (4 -)
646646
(4 -) :: Num a => a -> a
647647
```
648648

649-
↑こちらは関数
649+
`:t`コマンドの結果として出てきた`Num a => a -> a`という型は、「`Num`型クラスのインスタンスである型、`a`型の値を引数に取り、引数と同じ`a`型の値を返す関数」です。先ほどの`Num a => a`が単なる`a`型の値だったのから、`a -> a`という関数に変わりました。
650650

651-
```
651+
もちろん、実際に関数としても使うこともできます:
652652

653+
```haskell
653654
ghci> (4 -) 4
654655
0
655656
```

0 commit comments

Comments
 (0)