Ich lerne Haskell und bin ein wenig verwirrt, wie die Funktion Anwendungsoperator $ curry ist.
Nach GHC die Art von $ ist
*Main>:t ($)
($) :: (a->b) -> a -> b
Aber ich kann den folgenden Code
*Main>map ($ 2) [(*2), (+2), (/2)]
[4.0,4.0,1.0]
Nach der Unterschrift von $ geben, obwohl ich annehmen würde, müsste ich die Klappe verwenden Funktion, weil der erste Parameter zu $ ist (a-> b).
Zum Beispiel kann ich nicht tun, die folgenden
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"
Aber ich kann
let x = curry_test 2
Hinweis tun: '(*) :: Num a => a -> a -> a' – DiegoNolan