select

Constructor for computations in the selection monad.
Combinator for the <select> element. Example:
select $ span $ toHtml "foo"
Result:
<select><span>foo</span></select>
From a list of expressions choose the one, whose condition is true. Example:
select "boring" $
(even n, "even") :
(isPrime n, "prime") :
[]
Moves the lowest k elements to the front of the array. The elements will be in no particular order.
Moves the least k elements to the front of the array in no particular order.
Convert a list to a Shell that emits each element of the list
Retrieve the Event for the given key. The type of the Event is determined by the type of the key, so this can be used to fan-out Events whose sub-Events have different types. Using EventSelectors and the fan primitive is far more efficient than (but equivalent to) using mapMaybe to select only the relevant occurrences of an Event.
Execute an esqueleto SELECT query inside persistent's SqlPersistT monad and return a list of rows. We've seen that from has some magic about which kinds of things you may bring into scope. This select function also has some magic for which kinds of things you may bring back to Haskell-land by using SqlQuery's return:
  • You may return a SqlExpr (Entity v) for an entity v (i.e., like the * in SQL), which is then returned to Haskell-land as just Entity v.
  • You may return a SqlExpr (Maybe (Entity v)) for an entity v that may be NULL, which is then returned to Haskell-land as Maybe (Entity v). Used for OUTER JOINs.
  • You may return a SqlExpr (Value t) for a value t (i.e., a single column), where t is any instance of PersistField, which is then returned to Haskell-land as Value t. You may use Value to return projections of an Entity (see (^.) and (?.)) or to return any other value calculated on the query (e.g., countRows or subSelect).
The SqlSelect a r class has functional dependencies that allow type information to flow both from a to r and vice-versa. This means that you'll almost never have to give any type signatures for esqueleto queries. For example, the query select $ from $ \p -> return p alone is ambiguous, but in the context of
do ps <- select $
from $ \p ->
return p
liftIO $ mapM_ (putStrLn . personName . entityVal) ps
we are able to infer from that single personName . entityVal function composition that the p inside the query is of type SqlExpr (Entity Person).
Query or Selection that selects documents in collection that match selector. The choice of type depends on use, for example, in find (select sel col) it is a Query, and in delete (select sel col) it is a Selection.
Build a SqlSelect for the given Q.
"select f s n xs" selects n elements with step-size s and offset f from xs.
>>> select (SNat :: SNat 1) (SNat :: SNat 2) (SNat :: SNat 3) (1:>2:>3:>4:>5:>6:>7:>8:>Nil)
2 :> 4 :> 6 :> Nil

>>> select d1 d2 d3 (1:>2:>3:>4:>5:>6:>7:>8:>Nil)
2 :> 4 :> 6 :> Nil
Composes a predicate function and 2 functions into a single function. The first function is called when the predicate yields True, the second when the predicate yields False. Note that after importing Control.Monad.Instances, select becomes a special case of ifM.
The basic "if-then" selection primitive from Control.Selective.
Total indexing operation. select xs default index is intuitively the same as xs !! index, except it evaluates to default if index underflows/overflows.
Create a single named selection that may be applied to a data query or transformation.
sel =
selection
. select "view" Interval [ BindScales ] []
. select "myBrush" Interval []
. select "myPaintbrush" Multi [ On "mouseover", Nearest True ]
select a i denotes the value of a at i.