Reputation: 1346
Can't find anything about this syntax in Haskel/Elm:
bar day yOffset =
rect
[
x <| toString <| (day.xOffset * (barWidth + barMargin)),
y <| toString <| if day.amount <= 0 then yOffset
else yOffset - day.amount,
height <| toString <| abs day.amount,
width <| toString barWidth
]
[ Svg.title [] [ text day.day ] ]
min = List.map (\x -> x.words) lastTwoWeeks
|> List.minimum
|> Maybe.withDefault 0
|> (\x -> if x > 0 then 0 else x)
What does mean <| and |> ?
Upvotes: 2
Views: 559
Reputation: 170899
It isn't syntax, it's just a normal Elm function. From http://package.elm-lang.org/packages/elm-lang/core/3.0.0/Basics#%3C|:
(<|) : (a -> b) -> a -> b
Backward function application
f <| x == f x
. This function is useful for avoiding parenthesis
and similarly x |> f == f x
. The Haskell equivalent of <|
is called $
, and |>
is Data.Function.&
(added in Base 4.8.0.0).
Upvotes: 9