Questions tagged [operator-sections]

Operator sections is a feature in Haskell that lets us write partially applied infix operators, like `(+ 2)` meaning `(\x-> x + 2)`.

Operator sections is a feature in Haskell that lets us write partially applied infix operators, like (+ 2) meaning (\x-> x + 2).

More here.

6 questions
13
votes
3 answers

Partial Application with Infix Functions

While I understand a little about currying in the mathematical sense, partially applying an infix function was a new concept which I discovered after diving into the book Learn You a Haskell for Great Good. Given this function: applyTwice :: (a…
12
votes
4 answers

Haskell dollar operator application

I'm having trouble with understanding how function application works with currying in haskell. If I have following function: ($) :: (a -> b) -> a -> b I understand that to partially apply this function I need to provide (a -> b) function ($'s first…
9
votes
3 answers

Function application in Haskell

OK, it's been a long day and my brain may not function at Haskell level, but I just cannot understand one example from 'Learn You a Haskell'. The section is called Function Application with $, and there is example of how $ may be defined: ($) :: (a…
5
votes
2 answers

Operator section for applicative with <$> and <*>

Consider functions of type a -> b -> c, and the applicative values a1, a2 :: (Applicative f) => f a. I wish to construct a function which may be applied to functions of type a -> b -> c to obtain values of type Applicative f :: f c. I can do this…
frasertweedale
  • 5,424
  • 3
  • 26
  • 38
2
votes
3 answers

How to understand this `$` usage in Haskell

This happens in the situation you want to apply bunch of functions to the same variable, it may look like this: map (\f->f 4) [odd, even] but from LYAH using $ make it very neat map ($ 4) [odd, even] why does it work. first I type it in ghci like…
delta
  • 3,778
  • 15
  • 22
0
votes
3 answers

Is a section the result of currying?

In Programming in Haskell by Hutton In general, if # is an operator, then expressions of the form (#), (x #), and (# y) for arguments x and y are called sections, whose meaning as functions can be …
Tim
  • 1
  • 141
  • 372
  • 590