Multiple Variable Point Composition

I started hugging him around, but rather wanted to use it for simple situations in which I can essentially pass values โ€‹โ€‹from one output to one input. A simple example of a convenient composition with which I am comfortable would be:

let joinLines = foldr (++) "" . intersperse "\n"

During play time with GHCI today I wanted to see if I can create notand (==)to replicate (/=), but I could not explain it. (==)take two entrances, but notone. I thought this might work:

let ne = not . (==)

With the assumption that single output Bool (==)will go to not, but it will not compile, citing the following error:

<interactive>:1:16:
    Couldn't match expected type `Bool' with actual type `a0 -> Bool'
    Expected type: a0 -> Bool
      Actual type: a0 -> a0 -> Bool
    In the second argument of `(.)', namely `(==)'
    In the expression: not . (==)

, , , , , , , , (==), - not? - ?

+5
2

,

ne x y = not (x == y)
       = (not . (x ==)) y
ne x   = not . (x ==)
       = not . ((==) x)
       = ((not .) . (==)) x
ne     = (not .) . (==)

, (.), .

(==) - Eq a => a -> a -> Bool. , whatever . (==) x, whatever ((==) x), (==) x - a -> Bool ( a - x, of Eq). , whatever .

+14

(.:), , :

f . g  $ x
f .: g $ x y
+12

All Articles