0
なぜここ(-1)
作業の場合としない:マッピング以上のどちらかが
λ> (+1) <$> Right 10
Right 11
Prelude
λ> (-1) <$> Right 10
<interactive>:22:1: error:
• Non type-variable argument in the constraint: Num (a -> b)
(Use FlexibleContexts to permit this)
• When checking the inferred type
it :: forall a b a1. (Num (a -> b), Num a) => Either a1 b
Prelude
λ> (*1) <$> Right 10
Right 10
Prelude
λ> (/1) <$> Right 10
Right 10.0
Prelude
λ>
うんを試してみてください。しかし、もし私が10 - 1をやりたければどうすればそれを働かせることができますか? –
'flip'を使うか、ラムダを書くことができます。 dupの質問にリンクされているように 'subtract'もあります – Daenyth