KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am learning haskell and am a little confused how the function application operator $ curry's. According to GHC the type of $ is *Main>:t ($) ($) :: (a->b) -> a -> b But I can type the following code *Main>map ($ 2) [(*2), (+2), (/2)] [4.0,4.0,1.0] According to the signature of $ though I would assume I would need to use the flip function because the first parameter to $ is (a->b). For example, I can't do the following 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" But I can do let x = curry_test 2
Tags (comma-separated)
Save Edits
Cancel