IT練習ノート

IT関連で調べたこと(実際は嵌ったこと)を書いています。

Int * Doubleは不可

 > let a1 = 2 :: Int
 > let a2 = 3 :: Int
 > a1 * a2
6
 > let b1 = 2 :: Double
 > let b2 = 3 :: Double
 > b1 * b2
6.0
 > a1 * b2

<interactive>:1387:6: error:
    • Couldn't match expected type ‘Int’ with actual type ‘Double’
    • In the second argument of ‘(*)’, namely ‘b2’
      In the expression: a1 * b2
      In an equation for ‘it’: it = a1 * b2
 > a2 * b1

<interactive>:1388:6: error:
    • Couldn't match expected type ‘Int’ with actual type ‘Double’
    • In the second argument of ‘(*)’, namely ‘b1’
      In the expression: a2 * b1
      In an equation for ‘it’: it = a2 * b1
 >