1{-# language FlexibleContexts #-}
2{-# language TypeFamilies #-}
3{-# language ViewPatterns #-}
15import Rel8.Expr ( Expr )
16import Rel8.Expr.Bool ( boolExpr, caseExpr )
17import Rel8.Schema.Context ( Col'(..) )
18import Rel8.Schema.HTable ( htabulate, hfield )
19import Rel8.Table ( Table, fromColumns, toColumns )
22bool :: Table Expr a => a -> a -> Expr Bool -> a
23bool (toColumns -> false) (toColumns -> true) condition =
24 fromColumns $ htabulate $ \field ->
25 case (hfield false field, hfield true field) of
26 (DB falseExpr, DB trueExpr) ->
27 DB (boolExpr falseExpr trueExpr condition)
30case_ :: Table Expr a => [(Expr Bool, a)] -> a -> a
31case_ (map (fmap toColumns) -> branches) (toColumns -> fallback) =
32 fromColumns $ htabulate $ \field -> case hfield fallback field of
34 case map (fmap (unDB . (`hfield` field))) branches of
35 branchExprs -> DB (caseExpr branchExprs fallbackExpr)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list