Is there a better way to express (\(a, b) -> a < b)
with function composition? I feel like I'm missing something and experimenting with curry
only confused me more.
相关问题
- C#: How do i get 2 lists into one 2-tuple list in
- Understanding do notation for simple Reader monad:
- Making Custom Instances of PersistBackend
- Haskell: What is the differrence between `Num [a]
- applying a list to an entered function to check fo
相关文章
- Is it possible to write pattern-matched functions
- Haskell underscore vs. explicit variable
- Given a list and a bitmask, how do I return the va
- Top-level expression evaluation at compile time
- Stuck in the State Monad
- foldr vs foldr1 usage in Haskell
- List of checkboxes with digestive-functors
- How does this list comprehension over the inits of
curry
is the wrong thing to use here; it turns a function operating on tuples into a curried function. You want the opposite, which isuncurry
:In this case, it's
uncurry (<)
.(Another useful source for combinators useful in writing functions on tuples is
Control.Arrow
; since(->)
is an instance ofArrow
, you can reada b c
asb -> c
.)Looking at the types is the best way in Haskell to get the first idea, what any function does:
curry
: function of pair → curried function (it curries a function).uncurry
: curried function → function of pair.There are several interesting applications of
uncurry
, try to pass different arguments to functions below and see what they do: