
melston
Effective Haskell: Discussion of map (page 58 B2)
In the discussion of map on page 58 you present the example:
map ($ 10) [(+1), (*3), (`div` 5)]
This confuses me a lot. You introduces the function application operator ($) back on page 15 as a way of forcing validation of arguments prior to the evaluation of the function. In that case the $ comes after the function but before the arguments.
Here we have the $ 10 as the function. I look at this example and it seems to be completely backward. I know what you are doing but I just cannot make sense of how it works. In fact, the ‘div’ example is a great example of where I go off the rails trying to understand this. If I execute
div 5 $ 10
in ghci I get the result 0. And, of course, this doesn’t work at all:
$ 10 `div` 5 // or even $ 10 div 5
So what this does is
div 10 5
But, for the life of me, I cannot figure out how that happens from the given map command.
Popular Prag Prog topics










Other popular topics










Latest in PragProg
Latest (all)
Categories:
Popular Portals
- /elixir
- /rust
- /wasm
- /ruby
- /erlang
- /phoenix
- /keyboards
- /js
- /rails
- /python
- /security
- /go
- /swift
- /vim
- /clojure
- /java
- /haskell
- /emacs
- /svelte
- /onivim
- /typescript
- /crystal
- /c-plus-plus
- /tailwind
- /kotlin
- /gleam
- /react
- /flutter
- /elm
- /ocaml
- /vscode
- /opensuse
- /ash
- /centos
- /php
- /deepseek
- /scala
- /zig
- /html
- /debian
- /nixos
- /lisp
- /agda
- /textmate
- /sublime-text
- /react-native
- /kubuntu
- /arch-linux
- /ubuntu
- /revery
- /manjaro
- /django
- /spring
- /diversity
- /lua
- /nodejs
- /c
- /julia
- /slackware
- /neovim