Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion cabal.project
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
packages: .
packages:
rel8/rel8.cabal,
rel8-internal/rel8-internal.cabal

source-repository-package
type: git
Expand Down
2 changes: 1 addition & 1 deletion changelog.d/scriv.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[scriv]
format = md
output_file = Changelog.md
output_file = rel8/Changelog.md
File renamed without changes.
244 changes: 244 additions & 0 deletions rel8-internal/rel8-internal.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,244 @@
cabal-version: 3.0
name: rel8-internal
version: 1.7.0.0
synopsis: Internals of rel8
license: BSD-3-Clause
license-file: LICENSE
author: Oliver Charles
maintainer: ollie@ocharles.org.uk
homepage: https://github.com/circuithub/rel8
bug-reports: https://github.com/circuithub/rel8/issues
build-type: Simple

source-repository head
type: git
location: https://github.com/circuithub/rel8
subdir: rel8-internal

library
build-depends:
aeson
, attoparsec
, base >= 4.16 && < 4.23
, base16 >= 1.0
, base-compat >= 0.11 && < 0.15
, bytestring
, case-insensitive
, comonad
, containers
, contravariant
, hasql >= 1.8 && < 1.10
, iproute ^>= 1.7
, opaleye ^>= 0.10.2.1
, postgresql-binary ^>= 0.14.2
, pretty
, profunctors
, product-profunctors
, scientific
, semialign
, semigroupoids
, text
, these
, time
, transformers
, utf8-string
, uuid
, vector

default-language:
Haskell2010
ghc-options:
-Werror=missing-methods -Werror=incomplete-patterns -Werror=missing-fields
-Weverything -Wno-unsafe -Wno-safe -Wno-missing-safe-haskell-mode
-Wno-missing-import-lists -Wno-prepositive-qualified-module
-Wno-monomorphism-restriction
-Wno-missing-local-signatures
-Wno-missing-kind-signatures
-Wno-missing-role-annotations
-Wno-missing-deriving-strategies
-Wno-term-variable-capture
-Wno-missed-specializations

hs-source-dirs:
src

exposed-modules:
Rel8.Internal.Aggregate
Rel8.Internal.Aggregate.Fold
Rel8.Internal.Aggregate.Function
Rel8.Internal.Aggregate.Range

Rel8.Internal.Column
Rel8.Internal.Column.ADT
Rel8.Internal.Column.Either
Rel8.Internal.Column.Lift
Rel8.Internal.Column.List
Rel8.Internal.Column.Maybe
Rel8.Internal.Column.NonEmpty
Rel8.Internal.Column.Null
Rel8.Internal.Column.These

Rel8.Internal.Data.Range

Rel8.Internal.Expr
Rel8.Internal.Expr.Aggregate
Rel8.Internal.Expr.Array
Rel8.Internal.Expr.Bool
Rel8.Internal.Expr.Default
Rel8.Internal.Expr.Eq
Rel8.Internal.Expr.Function
Rel8.Internal.Expr.List
Rel8.Internal.Expr.NonEmpty
Rel8.Internal.Expr.Null
Rel8.Internal.Expr.Opaleye
Rel8.Internal.Expr.Ord
Rel8.Internal.Expr.Order
Rel8.Internal.Expr.Range
Rel8.Internal.Expr.Read
Rel8.Internal.Expr.Sequence
Rel8.Internal.Expr.Serialize
Rel8.Internal.Expr.Show
Rel8.Internal.Expr.Subscript
Rel8.Internal.Expr.Text
Rel8.Internal.Expr.Window

Rel8.Internal.FCF

Rel8.Internal.Kind.Algebra
Rel8.Internal.Kind.Context

Rel8.Internal.Generic.Construction
Rel8.Internal.Generic.Construction.ADT
Rel8.Internal.Generic.Construction.Record
Rel8.Internal.Generic.Map
Rel8.Internal.Generic.Record
Rel8.Internal.Generic.Rel8able
Rel8.Internal.Generic.Table
Rel8.Internal.Generic.Table.ADT
Rel8.Internal.Generic.Table.Record

Rel8.Internal.Order

Rel8.Internal.Query
Rel8.Internal.Query.Aggregate
Rel8.Internal.Query.Distinct
Rel8.Internal.Query.Each
Rel8.Internal.Query.Either
Rel8.Internal.Query.Evaluate
Rel8.Internal.Query.Exists
Rel8.Internal.Query.Filter
Rel8.Internal.Query.Function
Rel8.Internal.Query.Indexed
Rel8.Internal.Query.Limit
Rel8.Internal.Query.List
Rel8.Internal.Query.Loop
Rel8.Internal.Query.Materialize
Rel8.Internal.Query.Maybe
Rel8.Internal.Query.Null
Rel8.Internal.Query.Opaleye
Rel8.Internal.Query.Order
Rel8.Internal.Query.Rebind
Rel8.Internal.Query.Set
Rel8.Internal.Query.SQL
Rel8.Internal.Query.These
Rel8.Internal.Query.Values
Rel8.Internal.Query.Window

Rel8.Internal.Schema.Context.Nullify
Rel8.Internal.Schema.Dict
Rel8.Internal.Schema.Escape
Rel8.Internal.Schema.Field
Rel8.Internal.Schema.HTable
Rel8.Internal.Schema.HTable.Either
Rel8.Internal.Schema.HTable.Identity
Rel8.Internal.Schema.HTable.Label
Rel8.Internal.Schema.HTable.List
Rel8.Internal.Schema.HTable.MapTable
Rel8.Internal.Schema.HTable.Maybe
Rel8.Internal.Schema.HTable.NonEmpty
Rel8.Internal.Schema.HTable.Nullify
Rel8.Internal.Schema.HTable.Product
Rel8.Internal.Schema.HTable.These
Rel8.Internal.Schema.HTable.Vectorize
Rel8.Internal.Schema.Kind
Rel8.Internal.Schema.Name
Rel8.Internal.Schema.Null
Rel8.Internal.Schema.QualifiedName
Rel8.Internal.Schema.Result
Rel8.Internal.Schema.Spec
Rel8.Internal.Schema.Table

Rel8.Internal.Statement
Rel8.Internal.Statement.Delete
Rel8.Internal.Statement.Insert
Rel8.Internal.Statement.OnConflict
Rel8.Internal.Statement.Prepared
Rel8.Internal.Statement.Returning
Rel8.Internal.Statement.Rows
Rel8.Internal.Statement.Run
Rel8.Internal.Statement.Select
Rel8.Internal.Statement.Set
Rel8.Internal.Statement.SQL
Rel8.Internal.Statement.Update
Rel8.Internal.Statement.Using
Rel8.Internal.Statement.View
Rel8.Internal.Statement.Where

Rel8.Internal.Table
Rel8.Internal.Table.ADT
Rel8.Internal.Table.Aggregate
Rel8.Internal.Table.Aggregate.Maybe
Rel8.Internal.Table.Alternative
Rel8.Internal.Table.Bool
Rel8.Internal.Table.Cols
Rel8.Internal.Table.Either
Rel8.Internal.Table.Eq
Rel8.Internal.Table.HKD
Rel8.Internal.Table.List
Rel8.Internal.Table.Maybe
Rel8.Internal.Table.Name
Rel8.Internal.Table.NonEmpty
Rel8.Internal.Table.Null
Rel8.Internal.Table.Nullify
Rel8.Internal.Table.Opaleye
Rel8.Internal.Table.Ord
Rel8.Internal.Table.Order
Rel8.Internal.Table.Projection
Rel8.Internal.Table.Rel8able
Rel8.Internal.Table.Serialize
Rel8.Internal.Table.These
Rel8.Internal.Table.Transpose
Rel8.Internal.Table.Undefined
Rel8.Internal.Table.Verify
Rel8.Internal.Table.Window

Rel8.Internal.Type
Rel8.Internal.Type.Array
Rel8.Internal.Type.Builder.ByteString
Rel8.Internal.Type.Builder.Fold
Rel8.Internal.Type.Builder.Time
Rel8.Internal.Type.Composite
Rel8.Internal.Type.Decimal
Rel8.Internal.Type.Decoder
Rel8.Internal.Type.Eq
Rel8.Internal.Type.Encoder
Rel8.Internal.Type.Enum
Rel8.Internal.Type.Information
Rel8.Internal.Type.JSONEncoded
Rel8.Internal.Type.JSONBEncoded
Rel8.Internal.Type.Monoid
Rel8.Internal.Type.Name
Rel8.Internal.Type.Nullable
Rel8.Internal.Type.Num
Rel8.Internal.Type.Ord
Rel8.Internal.Type.Parser
Rel8.Internal.Type.Parser.ByteString
Rel8.Internal.Type.Parser.Time
Rel8.Internal.Type.Range
Rel8.Internal.Type.ReadShow
Rel8.Internal.Type.Semigroup
Rel8.Internal.Type.String
Rel8.Internal.Type.Sum
Rel8.Internal.Type.Tag

Rel8.Internal.Window
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{-# language ScopedTypeVariables #-}
{-# language StandaloneKindSignatures #-}

module Rel8.Aggregate
module Rel8.Internal.Aggregate
( Aggregator' (Aggregator)
, Aggregator
, Aggregator1
Expand Down Expand Up @@ -35,9 +35,9 @@ import Data.Profunctor.Product
import Data.Profunctor (Profunctor, dimap)

-- rel8
import Rel8.Expr (Expr)
import Rel8.Expr.Opaleye (toPrimExpr, toColumn)
import Rel8.Aggregate.Fold (Fallback (Empty, Fallback), Fold (Full, Semi))
import Rel8.Internal.Expr (Expr)
import Rel8.Internal.Expr.Opaleye (toPrimExpr, toColumn)
import Rel8.Internal.Aggregate.Fold (Fallback (Empty, Fallback), Fold (Full, Semi))

-- semigroupoids
import Data.Functor.Apply (Apply, liftF2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{-# language LambdaCase #-}
{-# language StandaloneKindSignatures #-}

module Rel8.Aggregate.Fold
module Rel8.Internal.Aggregate.Fold
( Fallback (Empty, Fallback)
, Fold (Semi, Full)
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{-# language FlexibleContexts #-}
{-# language MonoLocalBinds #-}

module Rel8.Aggregate.Function (
module Rel8.Internal.Aggregate.Function (
aggregateFunction,
rawAggregateFunction,
) where
Expand All @@ -14,15 +14,15 @@ import qualified Opaleye.Internal.Aggregate as Opaleye
import qualified Opaleye.Internal.HaskellDB.PrimQuery as Opaleye

-- rel8
import Rel8.Aggregate (Aggregator1, unsafeMakeAggregator)
import Rel8.Aggregate.Fold (Fallback (Empty))
import Rel8.Expr (Expr)
import Rel8.Expr.Opaleye (castExpr, fromColumn, fromPrimExpr)
import Rel8.Schema.Null (Sql)
import Rel8.Schema.QualifiedName (QualifiedName, showQualifiedName)
import Rel8.Table (Table)
import Rel8.Table.Opaleye (unpackspec)
import Rel8.Type (DBType)
import Rel8.Internal.Aggregate (Aggregator1, unsafeMakeAggregator)
import Rel8.Internal.Aggregate.Fold (Fallback (Empty))
import Rel8.Internal.Expr (Expr)
import Rel8.Internal.Expr.Opaleye (castExpr, fromColumn, fromPrimExpr)
import Rel8.Internal.Schema.Null (Sql)
import Rel8.Internal.Schema.QualifiedName (QualifiedName, showQualifiedName)
import Rel8.Internal.Table (Table)
import Rel8.Internal.Table.Opaleye (unpackspec)
import Rel8.Internal.Type (DBType)


-- | 'aggregateFunction' allows the use use of custom aggregation functions
Expand Down
21 changes: 21 additions & 0 deletions rel8-internal/src/Rel8/Internal/Aggregate/Range.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{-# LANGUAGE OverloadedStrings #-}

module Rel8.Internal.Aggregate.Range (
rangeAgg,
) where

-- base
import Prelude

-- rel8
import Rel8.Internal.Aggregate (Aggregator', toAggregator)
import Rel8.Internal.Aggregate.Function (aggregateFunction)
import Rel8.Internal.Data.Range (Multirange, Range)
import Rel8.Internal.Expr (Expr)
import Rel8.Internal.Type.Range (DBRange)


rangeAgg ::
DBRange a =>
Aggregator' fold (Expr (Range a)) (Expr (Multirange a))
rangeAgg = toAggregator mempty $ aggregateFunction "range_agg"
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{-# language StandaloneKindSignatures #-}
{-# language TypeFamilies #-}

module Rel8.Column
module Rel8.Internal.Column
( Column
, TColumn
)
Expand All @@ -13,9 +13,9 @@ import Data.Kind ( Type )
import Prelude ()

-- rel8
import Rel8.FCF ( Eval, Exp )
import qualified Rel8.Schema.Kind as K
import Rel8.Schema.Result ( Result )
import Rel8.Internal.FCF ( Eval, Exp )
import qualified Rel8.Internal.Schema.Kind as K
import Rel8.Internal.Schema.Result ( Result )


-- | This type family is used to specify columns in 'Rel8able's. In @Column f
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{-# language StandaloneKindSignatures #-}
{-# language TypeFamilies #-}

module Rel8.Column.ADT
module Rel8.Internal.Column.ADT
( HADT
)
where
Expand All @@ -12,9 +12,9 @@ import Data.Kind ( Type )
import Prelude ()

-- rel8
import qualified Rel8.Schema.Kind as K
import Rel8.Schema.Result ( Result )
import Rel8.Table.ADT ( ADT )
import qualified Rel8.Internal.Schema.Kind as K
import Rel8.Internal.Schema.Result ( Result )
import Rel8.Internal.Table.ADT ( ADT )


type HADT :: K.Context -> K.Rel8able -> Type
Expand Down
Loading
Loading