1{-# language DataKinds #-}
2{-# language FlexibleContexts #-}
3{-# language FlexibleInstances #-}
4{-# language MultiParamTypeClasses #-}
5{-# language OverloadedStrings #-}
6{-# language StandaloneKindSignatures #-}
7{-# language TypeFamilies #-}
8{-# language UndecidableInstances #-}
10module Rel8.Type.Monoid
11 ( DBMonoid( memptyExpr )
16import Data.Kind ( Constraint, Type )
17import Prelude hiding ( null )
20import Data.ByteString ( ByteString )
21import qualified Data.ByteString.Lazy as Lazy ( ByteString )
24import Data.CaseInsensitive ( CI )
27import {-# SOURCE #-} Rel8.Expr ( Expr )
28import Rel8.Expr.Array ( sempty )
29import Rel8.Expr.Serialize ( litExpr )
30import Rel8.Schema.Nullability
32 , Sql, HasNullability, nullabilization
34import Rel8.Type ( DBType, typeInformation )
35import Rel8.Type.Semigroup ( DBSemigroup )
38import Data.Text ( Text )
39import qualified Data.Text.Lazy as Lazy ( Text )
42import Data.Time.LocalTime ( CalendarDiffTime( CalendarDiffTime ) )
45-- | The class of 'DBType's that form a semigroup. This class is purely a Rel8
46-- concept, and exists to mirror the 'Monoid' class.
47type DBMonoid :: Type -> Constraint
48class DBSemigroup a => DBMonoid a where
49 -- The identity for '<>.'
53instance Sql DBType a => DBMonoid [a] where
54 memptyExpr = sempty nullabilization typeInformation
57instance DBMonoid CalendarDiffTime where
58 memptyExpr = litExpr (CalendarDiffTime 0 0)
61instance DBMonoid Text where
62 memptyExpr = litExpr ""
65instance DBMonoid Lazy.Text where
66 memptyExpr = litExpr ""
69instance DBMonoid (CI Text) where
70 memptyExpr = litExpr ""
73instance DBMonoid (CI Lazy.Text) where
74 memptyExpr = litExpr ""
77instance DBMonoid ByteString where
78 memptyExpr = litExpr ""
81instance DBMonoid Lazy.ByteString where
82 memptyExpr = litExpr ""
85instance {-# INCOHERENT #-} (HasNullability a, DBMonoid (Unnullify a)) =>
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