Sto imparando haskell e sono un po 'confuso come l'operatore dell'applicazione di funzione $ curry's.
Secondo GHC il tipo di $ è
*Main>:t ($)
($) :: (a->b) -> a -> b
ma posso digitare il seguente codice
*Main>map ($ 2) [(*2), (+2), (/2)]
[4.0,4.0,1.0]
Secondo la firma di $ anche se mi piacerebbe pensare che avrei avuto bisogno di usare il flip funzione perché il primo parametro a $ è (a-> b).
Per esempio, io non posso fare quanto segue
curry_test :: Integer -> String -> String
curry_test x y = (show x) ++ " " ++ y
*Main> let x = curry_test "123"
Couldn't match expected type `Integer' with actual type `[Char]'
In the first argument of `curry_test', namely `"123"'
In the expression: curry_test "123"
In an equation for `x': x = curry_test "123"
ma non posso fare
let x = curry_test 2
suggerimento: '(*) :: Num a => a -> a -> a' – DiegoNolan