{-# language DataKinds #-}
{-# language DeriveTraversable #-}
{-# language DerivingStrategies #-}
{-# language GeneralizedNewtypeDeriving #-}
{-# language NamedFieldPuns #-}
{-# language StandaloneKindSignatures #-}
{-# language TypeFamilies #-}
{-# language UndecidableInstances #-}
{-# options_ghc -fno-warn-redundant-constraints #-}
module Rel8.Type.Array1D
( Array1D( Array1D )
, getArray1D
)
where
import Data.Aeson
( ToJSON
, ToJSON1
, ToJSONKey
, FromJSON
, FromJSON1
, FromJSONKey
)
import Control.Applicative ( Alternative, (<|>) )
import Control.Monad ( MonadPlus )
import Data.Functor.Classes ( Eq1, Ord1, Read1, Show1 )
import Data.Kind ( Type )
import GHC.Exts ( IsList )
import Prelude hiding ( null )
import qualified Hasql.Decoders as Hasql
import qualified Opaleye.Internal.HaskellDB.PrimQuery as Opaleye
import Rel8.Expr.Opaleye ( zipPrimExprsWith )
import Rel8.Expr.Serialize ( litExpr )
import Rel8.Schema.Null ( Unnullify, Nullity( Null, NotNull ), Sql, nullable )
import Rel8.Type ( DBType, typeInformation )
import Rel8.Type.Eq ( DBEq )
import Rel8.Type.Information ( TypeInformation(..) )
import Rel8.Type.Monoid ( DBMonoid, memptyExpr )
import Rel8.Type.Ord ( DBMax, DBMin, DBOrd )
import Rel8.Type.Semigroup ( DBSemigroup, (<>.) )
import Data.Functor.Alt ( Alt, (<!>) )
import Data.Functor.Apply ( Apply )
import Data.Functor.Bind ( Bind )
import Data.Functor.Plus ( Plus )
import Data.Align ( Align )
import Data.Semialign ( Semialign )
import Data.Zip ( Repeat, Unzip, Zip )
newtype Array1D a = Array1D [a]
deriving stock Functor Array1D
Foldable Array1D
Functor Array1D
-> Foldable Array1D
-> (forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Array1D a -> f (Array1D b))
-> (forall (f :: * -> *) a.
Applicative f =>
Array1D (f a) -> f (Array1D a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Array1D a -> m (Array1D b))
-> (forall (m :: * -> *) a.
Monad m =>
Array1D (m a) -> m (Array1D a))
-> Traversable Array1D
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a. Monad m => Array1D (m a) -> m (Array1D a)
forall (f :: * -> *) a.
Applicative f =>
Array1D (f a) -> f (Array1D a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Array1D a -> m (Array1D b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Array1D a -> f (Array1D b)
sequence :: forall (m :: * -> *) a. Monad m => Array1D (m a) -> m (Array1D a)
$csequence :: forall (m :: * -> *) a. Monad m => Array1D (m a) -> m (Array1D a)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Array1D a -> m (Array1D b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Array1D a -> m (Array1D b)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
Array1D (f a) -> f (Array1D a)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
Array1D (f a) -> f (Array1D a)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Array1D a -> f (Array1D b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Array1D a -> f (Array1D b)
Traversable
deriving newtype
( Array1D a -> Array1D a -> Bool
(Array1D a -> Array1D a -> Bool)
-> (Array1D a -> Array1D a -> Bool) -> Eq (Array1D a)
forall a. Eq a => Array1D a -> Array1D a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Array1D a -> Array1D a -> Bool
$c/= :: forall a. Eq a => Array1D a -> Array1D a -> Bool
== :: Array1D a -> Array1D a -> Bool
$c== :: forall a. Eq a => Array1D a -> Array1D a -> Bool
Eq, Eq (Array1D a)
Eq (Array1D a)
-> (Array1D a -> Array1D a -> Ordering)
-> (Array1D a -> Array1D a -> Bool)
-> (Array1D a -> Array1D a -> Bool)
-> (Array1D a -> Array1D a -> Bool)
-> (Array1D a -> Array1D a -> Bool)
-> (Array1D a -> Array1D a -> Array1D a)
-> (Array1D a -> Array1D a -> Array1D a)
-> Ord (Array1D a)
Array1D a -> Array1D a -> Bool
Array1D a -> Array1D a -> Ordering
Array1D a -> Array1D a -> Array1D a
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {a}. Ord a => Eq (Array1D a)
forall a. Ord a => Array1D a -> Array1D a -> Bool
forall a. Ord a => Array1D a -> Array1D a -> Ordering
forall a. Ord a => Array1D a -> Array1D a -> Array1D a
min :: Array1D a -> Array1D a -> Array1D a
$cmin :: forall a. Ord a => Array1D a -> Array1D a -> Array1D a
max :: Array1D a -> Array1D a -> Array1D a
$cmax :: forall a. Ord a => Array1D a -> Array1D a -> Array1D a
>= :: Array1D a -> Array1D a -> Bool
$c>= :: forall a. Ord a => Array1D a -> Array1D a -> Bool
> :: Array1D a -> Array1D a -> Bool
$c> :: forall a. Ord a => Array1D a -> Array1D a -> Bool
<= :: Array1D a -> Array1D a -> Bool
$c<= :: forall a. Ord a => Array1D a -> Array1D a -> Bool
< :: Array1D a -> Array1D a -> Bool
$c< :: forall a. Ord a => Array1D a -> Array1D a -> Bool
compare :: Array1D a -> Array1D a -> Ordering
$ccompare :: forall a. Ord a => Array1D a -> Array1D a -> Ordering
Ord, ReadPrec [Array1D a]
ReadPrec (Array1D a)
Int -> ReadS (Array1D a)
ReadS [Array1D a]
(Int -> ReadS (Array1D a))
-> ReadS [Array1D a]
-> ReadPrec (Array1D a)
-> ReadPrec [Array1D a]
-> Read (Array1D a)
forall a. Read a => ReadPrec [Array1D a]
forall a. Read a => ReadPrec (Array1D a)
forall a. Read a => Int -> ReadS (Array1D a)
forall a. Read a => ReadS [Array1D a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Array1D a]
$creadListPrec :: forall a. Read a => ReadPrec [Array1D a]
readPrec :: ReadPrec (Array1D a)
$creadPrec :: forall a. Read a => ReadPrec (Array1D a)
readList :: ReadS [Array1D a]
$creadList :: forall a. Read a => ReadS [Array1D a]
readsPrec :: Int -> ReadS (Array1D a)
$creadsPrec :: forall a. Read a => Int -> ReadS (Array1D a)
Read, Int -> Array1D a -> ShowS
[Array1D a] -> ShowS
Array1D a -> String
(Int -> Array1D a -> ShowS)
-> (Array1D a -> String)
-> ([Array1D a] -> ShowS)
-> Show (Array1D a)
forall a. Show a => Int -> Array1D a -> ShowS
forall a. Show a => [Array1D a] -> ShowS
forall a. Show a => Array1D a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Array1D a] -> ShowS
$cshowList :: forall a. Show a => [Array1D a] -> ShowS
show :: Array1D a -> String
$cshow :: forall a. Show a => Array1D a -> String
showsPrec :: Int -> Array1D a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> Array1D a -> ShowS
Show, NonEmpty (Array1D a) -> Array1D a
Array1D a -> Array1D a -> Array1D a
(Array1D a -> Array1D a -> Array1D a)
-> (NonEmpty (Array1D a) -> Array1D a)
-> (forall b. Integral b => b -> Array1D a -> Array1D a)
-> Semigroup (Array1D a)
forall b. Integral b => b -> Array1D a -> Array1D a
forall a. NonEmpty (Array1D a) -> Array1D a
forall a. Array1D a -> Array1D a -> Array1D a
forall a.
(a -> a -> a)
-> (NonEmpty a -> a)
-> (forall b. Integral b => b -> a -> a)
-> Semigroup a
forall a b. Integral b => b -> Array1D a -> Array1D a
stimes :: forall b. Integral b => b -> Array1D a -> Array1D a
$cstimes :: forall a b. Integral b => b -> Array1D a -> Array1D a
sconcat :: NonEmpty (Array1D a) -> Array1D a
$csconcat :: forall a. NonEmpty (Array1D a) -> Array1D a
<> :: Array1D a -> Array1D a -> Array1D a
$c<> :: forall a. Array1D a -> Array1D a -> Array1D a
Semigroup, Semigroup (Array1D a)
Array1D a
Semigroup (Array1D a)
-> Array1D a
-> (Array1D a -> Array1D a -> Array1D a)
-> ([Array1D a] -> Array1D a)
-> Monoid (Array1D a)
[Array1D a] -> Array1D a
Array1D a -> Array1D a -> Array1D a
forall a. Semigroup (Array1D a)
forall a. Array1D a
forall a.
Semigroup a -> a -> (a -> a -> a) -> ([a] -> a) -> Monoid a
forall a. [Array1D a] -> Array1D a
forall a. Array1D a -> Array1D a -> Array1D a
mconcat :: [Array1D a] -> Array1D a
$cmconcat :: forall a. [Array1D a] -> Array1D a
mappend :: Array1D a -> Array1D a -> Array1D a
$cmappend :: forall a. Array1D a -> Array1D a -> Array1D a
mempty :: Array1D a
$cmempty :: forall a. Array1D a
Monoid, Int -> [Item (Array1D a)] -> Array1D a
[Item (Array1D a)] -> Array1D a
Array1D a -> [Item (Array1D a)]
([Item (Array1D a)] -> Array1D a)
-> (Int -> [Item (Array1D a)] -> Array1D a)
-> (Array1D a -> [Item (Array1D a)])
-> IsList (Array1D a)
forall a. Int -> [Item (Array1D a)] -> Array1D a
forall a. [Item (Array1D a)] -> Array1D a
forall a. Array1D a -> [Item (Array1D a)]
forall l.
([Item l] -> l)
-> (Int -> [Item l] -> l) -> (l -> [Item l]) -> IsList l
toList :: Array1D a -> [Item (Array1D a)]
$ctoList :: forall a. Array1D a -> [Item (Array1D a)]
fromListN :: Int -> [Item (Array1D a)] -> Array1D a
$cfromListN :: forall a. Int -> [Item (Array1D a)] -> Array1D a
fromList :: [Item (Array1D a)] -> Array1D a
$cfromList :: forall a. [Item (Array1D a)] -> Array1D a
IsList
, (forall a b. (a -> b) -> Array1D a -> Array1D b)
-> (forall a b. a -> Array1D b -> Array1D a) -> Functor Array1D
forall a b. a -> Array1D b -> Array1D a
forall a b. (a -> b) -> Array1D a -> Array1D b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> Array1D b -> Array1D a
$c<$ :: forall a b. a -> Array1D b -> Array1D a
fmap :: forall a b. (a -> b) -> Array1D a -> Array1D b
$cfmap :: forall a b. (a -> b) -> Array1D a -> Array1D b
Functor, (forall m. Monoid m => Array1D m -> m)
-> (forall m a. Monoid m => (a -> m) -> Array1D a -> m)
-> (forall m a. Monoid m => (a -> m) -> Array1D a -> m)
-> (forall a b. (a -> b -> b) -> b -> Array1D a -> b)
-> (forall a b. (a -> b -> b) -> b -> Array1D a -> b)
-> (forall b a. (b -> a -> b) -> b -> Array1D a -> b)
-> (forall b a. (b -> a -> b) -> b -> Array1D a -> b)
-> (forall a. (a -> a -> a) -> Array1D a -> a)
-> (forall a. (a -> a -> a) -> Array1D a -> a)
-> (forall a. Array1D a -> [a])
-> (forall a. Array1D a -> Bool)
-> (forall a. Array1D a -> Int)
-> (forall a. Eq a => a -> Array1D a -> Bool)
-> (forall a. Ord a => Array1D a -> a)
-> (forall a. Ord a => Array1D a -> a)
-> (forall a. Num a => Array1D a -> a)
-> (forall a. Num a => Array1D a -> a)
-> Foldable Array1D
forall a. Eq a => a -> Array1D a -> Bool
forall a. Num a => Array1D a -> a
forall a. Ord a => Array1D a -> a
forall m. Monoid m => Array1D m -> m
forall a. Array1D a -> Bool
forall a. Array1D a -> Int
forall a. Array1D a -> [a]
forall a. (a -> a -> a) -> Array1D a -> a
forall m a. Monoid m => (a -> m) -> Array1D a -> m
forall b a. (b -> a -> b) -> b -> Array1D a -> b
forall a b. (a -> b -> b) -> b -> Array1D a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: forall a. Num a => Array1D a -> a
$cproduct :: forall a. Num a => Array1D a -> a
sum :: forall a. Num a => Array1D a -> a
$csum :: forall a. Num a => Array1D a -> a
minimum :: forall a. Ord a => Array1D a -> a
$cminimum :: forall a. Ord a => Array1D a -> a
maximum :: forall a. Ord a => Array1D a -> a
$cmaximum :: forall a. Ord a => Array1D a -> a
elem :: forall a. Eq a => a -> Array1D a -> Bool
$celem :: forall a. Eq a => a -> Array1D a -> Bool
length :: forall a. Array1D a -> Int
$clength :: forall a. Array1D a -> Int
null :: forall a. Array1D a -> Bool
$cnull :: forall a. Array1D a -> Bool
toList :: forall a. Array1D a -> [a]
$ctoList :: forall a. Array1D a -> [a]
foldl1 :: forall a. (a -> a -> a) -> Array1D a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> Array1D a -> a
foldr1 :: forall a. (a -> a -> a) -> Array1D a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> Array1D a -> a
foldl' :: forall b a. (b -> a -> b) -> b -> Array1D a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> Array1D a -> b
foldl :: forall b a. (b -> a -> b) -> b -> Array1D a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> Array1D a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> Array1D a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> Array1D a -> b
foldr :: forall a b. (a -> b -> b) -> b -> Array1D a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> Array1D a -> b
foldMap' :: forall m a. Monoid m => (a -> m) -> Array1D a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> Array1D a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> Array1D a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> Array1D a -> m
fold :: forall m. Monoid m => Array1D m -> m
$cfold :: forall m. Monoid m => Array1D m -> m
Foldable
, (forall a b. (a -> b -> Bool) -> Array1D a -> Array1D b -> Bool)
-> Eq1 Array1D
forall a b. (a -> b -> Bool) -> Array1D a -> Array1D b -> Bool
forall (f :: * -> *).
(forall a b. (a -> b -> Bool) -> f a -> f b -> Bool) -> Eq1 f
liftEq :: forall a b. (a -> b -> Bool) -> Array1D a -> Array1D b -> Bool
$cliftEq :: forall a b. (a -> b -> Bool) -> Array1D a -> Array1D b -> Bool
Eq1, Eq1 Array1D
Eq1 Array1D
-> (forall a b.
(a -> b -> Ordering) -> Array1D a -> Array1D b -> Ordering)
-> Ord1 Array1D
forall a b.
(a -> b -> Ordering) -> Array1D a -> Array1D b -> Ordering
forall (f :: * -> *).
Eq1 f
-> (forall a b. (a -> b -> Ordering) -> f a -> f b -> Ordering)
-> Ord1 f
liftCompare :: forall a b.
(a -> b -> Ordering) -> Array1D a -> Array1D b -> Ordering
$cliftCompare :: forall a b.
(a -> b -> Ordering) -> Array1D a -> Array1D b -> Ordering
Ord1, (forall a.
(Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Array1D a))
-> (forall a. (Int -> ReadS a) -> ReadS [a] -> ReadS [Array1D a])
-> (forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec (Array1D a))
-> (forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec [Array1D a])
-> Read1 Array1D
forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec [Array1D a]
forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec (Array1D a)
forall a. (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Array1D a)
forall a. (Int -> ReadS a) -> ReadS [a] -> ReadS [Array1D a]
forall (f :: * -> *).
(forall a. (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (f a))
-> (forall a. (Int -> ReadS a) -> ReadS [a] -> ReadS [f a])
-> (forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec (f a))
-> (forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec [f a])
-> Read1 f
liftReadListPrec :: forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec [Array1D a]
$cliftReadListPrec :: forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec [Array1D a]
liftReadPrec :: forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec (Array1D a)
$cliftReadPrec :: forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec (Array1D a)
liftReadList :: forall a. (Int -> ReadS a) -> ReadS [a] -> ReadS [Array1D a]
$cliftReadList :: forall a. (Int -> ReadS a) -> ReadS [a] -> ReadS [Array1D a]
liftReadsPrec :: forall a. (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Array1D a)
$cliftReadsPrec :: forall a. (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Array1D a)
Read1, (forall a.
(Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Array1D a -> ShowS)
-> (forall a.
(Int -> a -> ShowS) -> ([a] -> ShowS) -> [Array1D a] -> ShowS)
-> Show1 Array1D
forall a.
(Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Array1D a -> ShowS
forall a.
(Int -> a -> ShowS) -> ([a] -> ShowS) -> [Array1D a] -> ShowS
forall (f :: * -> *).
(forall a.
(Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS)
-> (forall a.
(Int -> a -> ShowS) -> ([a] -> ShowS) -> [f a] -> ShowS)
-> Show1 f
liftShowList :: forall a.
(Int -> a -> ShowS) -> ([a] -> ShowS) -> [Array1D a] -> ShowS
$cliftShowList :: forall a.
(Int -> a -> ShowS) -> ([a] -> ShowS) -> [Array1D a] -> ShowS
liftShowsPrec :: forall a.
(Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Array1D a -> ShowS
$cliftShowsPrec :: forall a.
(Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Array1D a -> ShowS
Show1
, (forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Value -> Parser (Array1D a))
-> (forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Value -> Parser [Array1D a])
-> FromJSON1 Array1D
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Value -> Parser [Array1D a]
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Value -> Parser (Array1D a)
forall (f :: * -> *).
(forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Value -> Parser (f a))
-> (forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Value -> Parser [f a])
-> FromJSON1 f
liftParseJSONList :: forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Value -> Parser [Array1D a]
$cliftParseJSONList :: forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Value -> Parser [Array1D a]
liftParseJSON :: forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Value -> Parser (Array1D a)
$cliftParseJSON :: forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Value -> Parser (Array1D a)
FromJSON1, (forall a. (a -> Value) -> ([a] -> Value) -> Array1D a -> Value)
-> (forall a.
(a -> Value) -> ([a] -> Value) -> [Array1D a] -> Value)
-> (forall a.
(a -> Encoding) -> ([a] -> Encoding) -> Array1D a -> Encoding)
-> (forall a.
(a -> Encoding) -> ([a] -> Encoding) -> [Array1D a] -> Encoding)
-> ToJSON1 Array1D
forall a. (a -> Value) -> ([a] -> Value) -> [Array1D a] -> Value
forall a. (a -> Value) -> ([a] -> Value) -> Array1D a -> Value
forall a.
(a -> Encoding) -> ([a] -> Encoding) -> [Array1D a] -> Encoding
forall a.
(a -> Encoding) -> ([a] -> Encoding) -> Array1D a -> Encoding
forall (f :: * -> *).
(forall a. (a -> Value) -> ([a] -> Value) -> f a -> Value)
-> (forall a. (a -> Value) -> ([a] -> Value) -> [f a] -> Value)
-> (forall a.
(a -> Encoding) -> ([a] -> Encoding) -> f a -> Encoding)
-> (forall a.
(a -> Encoding) -> ([a] -> Encoding) -> [f a] -> Encoding)
-> ToJSON1 f
liftToEncodingList :: forall a.
(a -> Encoding) -> ([a] -> Encoding) -> [Array1D a] -> Encoding
$cliftToEncodingList :: forall a.
(a -> Encoding) -> ([a] -> Encoding) -> [Array1D a] -> Encoding
liftToEncoding :: forall a.
(a -> Encoding) -> ([a] -> Encoding) -> Array1D a -> Encoding
$cliftToEncoding :: forall a.
(a -> Encoding) -> ([a] -> Encoding) -> Array1D a -> Encoding
liftToJSONList :: forall a. (a -> Value) -> ([a] -> Value) -> [Array1D a] -> Value
$cliftToJSONList :: forall a. (a -> Value) -> ([a] -> Value) -> [Array1D a] -> Value
liftToJSON :: forall a. (a -> Value) -> ([a] -> Value) -> Array1D a -> Value
$cliftToJSON :: forall a. (a -> Value) -> ([a] -> Value) -> Array1D a -> Value
ToJSON1, Value -> Parser [Array1D a]
Value -> Parser (Array1D a)
(Value -> Parser (Array1D a))
-> (Value -> Parser [Array1D a]) -> FromJSON (Array1D a)
forall a. FromJSON a => Value -> Parser [Array1D a]
forall a. FromJSON a => Value -> Parser (Array1D a)
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [Array1D a]
$cparseJSONList :: forall a. FromJSON a => Value -> Parser [Array1D a]
parseJSON :: Value -> Parser (Array1D a)
$cparseJSON :: forall a. FromJSON a => Value -> Parser (Array1D a)
FromJSON, FromJSONKeyFunction [Array1D a]
FromJSONKeyFunction (Array1D a)
FromJSONKeyFunction (Array1D a)
-> FromJSONKeyFunction [Array1D a] -> FromJSONKey (Array1D a)
forall a.
(FromJSONKey a, FromJSON a) =>
FromJSONKeyFunction [Array1D a]
forall a.
(FromJSONKey a, FromJSON a) =>
FromJSONKeyFunction (Array1D a)
forall a.
FromJSONKeyFunction a -> FromJSONKeyFunction [a] -> FromJSONKey a
fromJSONKeyList :: FromJSONKeyFunction [Array1D a]
$cfromJSONKeyList :: forall a.
(FromJSONKey a, FromJSON a) =>
FromJSONKeyFunction [Array1D a]
fromJSONKey :: FromJSONKeyFunction (Array1D a)
$cfromJSONKey :: forall a.
(FromJSONKey a, FromJSON a) =>
FromJSONKeyFunction (Array1D a)
FromJSONKey, [Array1D a] -> Value
[Array1D a] -> Encoding
Array1D a -> Value
Array1D a -> Encoding
(Array1D a -> Value)
-> (Array1D a -> Encoding)
-> ([Array1D a] -> Value)
-> ([Array1D a] -> Encoding)
-> ToJSON (Array1D a)
forall a. ToJSON a => [Array1D a] -> Value
forall a. ToJSON a => [Array1D a] -> Encoding
forall a. ToJSON a => Array1D a -> Value
forall a. ToJSON a => Array1D a -> Encoding
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [Array1D a] -> Encoding
$ctoEncodingList :: forall a. ToJSON a => [Array1D a] -> Encoding
toJSONList :: [Array1D a] -> Value
$ctoJSONList :: forall a. ToJSON a => [Array1D a] -> Value
toEncoding :: Array1D a -> Encoding
$ctoEncoding :: forall a. ToJSON a => Array1D a -> Encoding
toJSON :: Array1D a -> Value
$ctoJSON :: forall a. ToJSON a => Array1D a -> Value
ToJSON, ToJSONKeyFunction [Array1D a]
ToJSONKeyFunction (Array1D a)
ToJSONKeyFunction (Array1D a)
-> ToJSONKeyFunction [Array1D a] -> ToJSONKey (Array1D a)
forall a. (ToJSONKey a, ToJSON a) => ToJSONKeyFunction [Array1D a]
forall a. (ToJSONKey a, ToJSON a) => ToJSONKeyFunction (Array1D a)
forall a.
ToJSONKeyFunction a -> ToJSONKeyFunction [a] -> ToJSONKey a
toJSONKeyList :: ToJSONKeyFunction [Array1D a]
$ctoJSONKeyList :: forall a. (ToJSONKey a, ToJSON a) => ToJSONKeyFunction [Array1D a]
toJSONKey :: ToJSONKeyFunction (Array1D a)
$ctoJSONKey :: forall a. (ToJSONKey a, ToJSON a) => ToJSONKeyFunction (Array1D a)
ToJSONKey
, Functor Array1D
Functor Array1D
-> (forall a b. Array1D (a -> b) -> Array1D a -> Array1D b)
-> (forall a b. Array1D a -> Array1D b -> Array1D b)
-> (forall a b. Array1D a -> Array1D b -> Array1D a)
-> (forall a b c.
(a -> b -> c) -> Array1D a -> Array1D b -> Array1D c)
-> Apply Array1D
forall a b. Array1D a -> Array1D b -> Array1D a
forall a b. Array1D a -> Array1D b -> Array1D b
forall a b. Array1D (a -> b) -> Array1D a -> Array1D b
forall a b c. (a -> b -> c) -> Array1D a -> Array1D b -> Array1D c
forall (f :: * -> *).
Functor f
-> (forall a b. f (a -> b) -> f a -> f b)
-> (forall a b. f a -> f b -> f b)
-> (forall a b. f a -> f b -> f a)
-> (forall a b c. (a -> b -> c) -> f a -> f b -> f c)
-> Apply f
liftF2 :: forall a b c. (a -> b -> c) -> Array1D a -> Array1D b -> Array1D c
$cliftF2 :: forall a b c. (a -> b -> c) -> Array1D a -> Array1D b -> Array1D c
<. :: forall a b. Array1D a -> Array1D b -> Array1D a
$c<. :: forall a b. Array1D a -> Array1D b -> Array1D a
.> :: forall a b. Array1D a -> Array1D b -> Array1D b
$c.> :: forall a b. Array1D a -> Array1D b -> Array1D b
<.> :: forall a b. Array1D (a -> b) -> Array1D a -> Array1D b
$c<.> :: forall a b. Array1D (a -> b) -> Array1D a -> Array1D b
Apply, Functor Array1D
Functor Array1D
-> (forall a. a -> Array1D a)
-> (forall a b. Array1D (a -> b) -> Array1D a -> Array1D b)
-> (forall a b c.
(a -> b -> c) -> Array1D a -> Array1D b -> Array1D c)
-> (forall a b. Array1D a -> Array1D b -> Array1D b)
-> (forall a b. Array1D a -> Array1D b -> Array1D a)
-> Applicative Array1D
forall a. a -> Array1D a
forall a b. Array1D a -> Array1D b -> Array1D a
forall a b. Array1D a -> Array1D b -> Array1D b
forall a b. Array1D (a -> b) -> Array1D a -> Array1D b
forall a b c. (a -> b -> c) -> Array1D a -> Array1D b -> Array1D c
forall (f :: * -> *).
Functor f
-> (forall a. a -> f a)
-> (forall a b. f (a -> b) -> f a -> f b)
-> (forall a b c. (a -> b -> c) -> f a -> f b -> f c)
-> (forall a b. f a -> f b -> f b)
-> (forall a b. f a -> f b -> f a)
-> Applicative f
<* :: forall a b. Array1D a -> Array1D b -> Array1D a
$c<* :: forall a b. Array1D a -> Array1D b -> Array1D a
*> :: forall a b. Array1D a -> Array1D b -> Array1D b
$c*> :: forall a b. Array1D a -> Array1D b -> Array1D b
liftA2 :: forall a b c. (a -> b -> c) -> Array1D a -> Array1D b -> Array1D c
$cliftA2 :: forall a b c. (a -> b -> c) -> Array1D a -> Array1D b -> Array1D c
<*> :: forall a b. Array1D (a -> b) -> Array1D a -> Array1D b
$c<*> :: forall a b. Array1D (a -> b) -> Array1D a -> Array1D b
pure :: forall a. a -> Array1D a
$cpure :: forall a. a -> Array1D a
Applicative, Applicative Array1D
Applicative Array1D
-> (forall a. Array1D a)
-> (forall a. Array1D a -> Array1D a -> Array1D a)
-> (forall a. Array1D a -> Array1D [a])
-> (forall a. Array1D a -> Array1D [a])
-> Alternative Array1D
forall a. Array1D a
forall a. Array1D a -> Array1D [a]
forall a. Array1D a -> Array1D a -> Array1D a
forall (f :: * -> *).
Applicative f
-> (forall a. f a)
-> (forall a. f a -> f a -> f a)
-> (forall a. f a -> f [a])
-> (forall a. f a -> f [a])
-> Alternative f
many :: forall a. Array1D a -> Array1D [a]
$cmany :: forall a. Array1D a -> Array1D [a]
some :: forall a. Array1D a -> Array1D [a]
$csome :: forall a. Array1D a -> Array1D [a]
<|> :: forall a. Array1D a -> Array1D a -> Array1D a
$c<|> :: forall a. Array1D a -> Array1D a -> Array1D a
empty :: forall a. Array1D a
$cempty :: forall a. Array1D a
Alternative, Alt Array1D
Alt Array1D -> (forall a. Array1D a) -> Plus Array1D
forall a. Array1D a
forall (f :: * -> *). Alt f -> (forall a. f a) -> Plus f
zero :: forall a. Array1D a
$czero :: forall a. Array1D a
Plus, Apply Array1D
Apply Array1D
-> (forall a b. Array1D a -> (a -> Array1D b) -> Array1D b)
-> (forall a. Array1D (Array1D a) -> Array1D a)
-> Bind Array1D
forall a. Array1D (Array1D a) -> Array1D a
forall a b. Array1D a -> (a -> Array1D b) -> Array1D b
forall (m :: * -> *).
Apply m
-> (forall a b. m a -> (a -> m b) -> m b)
-> (forall a. m (m a) -> m a)
-> Bind m
join :: forall a. Array1D (Array1D a) -> Array1D a
$cjoin :: forall a. Array1D (Array1D a) -> Array1D a
>>- :: forall a b. Array1D a -> (a -> Array1D b) -> Array1D b
$c>>- :: forall a b. Array1D a -> (a -> Array1D b) -> Array1D b
Bind, Applicative Array1D
Applicative Array1D
-> (forall a b. Array1D a -> (a -> Array1D b) -> Array1D b)
-> (forall a b. Array1D a -> Array1D b -> Array1D b)
-> (forall a. a -> Array1D a)
-> Monad Array1D
forall a. a -> Array1D a
forall a b. Array1D a -> Array1D b -> Array1D b
forall a b. Array1D a -> (a -> Array1D b) -> Array1D b
forall (m :: * -> *).
Applicative m
-> (forall a b. m a -> (a -> m b) -> m b)
-> (forall a b. m a -> m b -> m b)
-> (forall a. a -> m a)
-> Monad m
return :: forall a. a -> Array1D a
$creturn :: forall a. a -> Array1D a
>> :: forall a b. Array1D a -> Array1D b -> Array1D b
$c>> :: forall a b. Array1D a -> Array1D b -> Array1D b
>>= :: forall a b. Array1D a -> (a -> Array1D b) -> Array1D b
$c>>= :: forall a b. Array1D a -> (a -> Array1D b) -> Array1D b
Monad, Monad Array1D
Alternative Array1D
Alternative Array1D
-> Monad Array1D
-> (forall a. Array1D a)
-> (forall a. Array1D a -> Array1D a -> Array1D a)
-> MonadPlus Array1D
forall a. Array1D a
forall a. Array1D a -> Array1D a -> Array1D a
forall (m :: * -> *).
Alternative m
-> Monad m
-> (forall a. m a)
-> (forall a. m a -> m a -> m a)
-> MonadPlus m
mplus :: forall a. Array1D a -> Array1D a -> Array1D a
$cmplus :: forall a. Array1D a -> Array1D a -> Array1D a
mzero :: forall a. Array1D a
$cmzero :: forall a. Array1D a
MonadPlus
, Semialign Array1D
Semialign Array1D -> (forall a. Array1D a) -> Align Array1D
forall a. Array1D a
forall (f :: * -> *). Semialign f -> (forall a. f a) -> Align f
nil :: forall a. Array1D a
$cnil :: forall a. Array1D a
Align, Functor Array1D
Functor Array1D
-> (forall a b. Array1D a -> Array1D b -> Array1D (These a b))
-> (forall a b c.
(These a b -> c) -> Array1D a -> Array1D b -> Array1D c)
-> Semialign Array1D
forall a b. Array1D a -> Array1D b -> Array1D (These a b)
forall a b c.
(These a b -> c) -> Array1D a -> Array1D b -> Array1D c
forall (f :: * -> *).
Functor f
-> (forall a b. f a -> f b -> f (These a b))
-> (forall a b c. (These a b -> c) -> f a -> f b -> f c)
-> Semialign f
alignWith :: forall a b c.
(These a b -> c) -> Array1D a -> Array1D b -> Array1D c
$calignWith :: forall a b c.
(These a b -> c) -> Array1D a -> Array1D b -> Array1D c
align :: forall a b. Array1D a -> Array1D b -> Array1D (These a b)
$calign :: forall a b. Array1D a -> Array1D b -> Array1D (These a b)
Semialign, Zip Array1D
Zip Array1D -> (forall a. a -> Array1D a) -> Repeat Array1D
forall a. a -> Array1D a
forall (f :: * -> *). Zip f -> (forall a. a -> f a) -> Repeat f
repeat :: forall a. a -> Array1D a
$crepeat :: forall a. a -> Array1D a
Repeat, Zip Array1D
Zip Array1D
-> (forall c a b.
(c -> (a, b)) -> Array1D c -> (Array1D a, Array1D b))
-> (forall a b. Array1D (a, b) -> (Array1D a, Array1D b))
-> Unzip Array1D
forall a b. Array1D (a, b) -> (Array1D a, Array1D b)
forall c a b. (c -> (a, b)) -> Array1D c -> (Array1D a, Array1D b)
forall (f :: * -> *).
Zip f
-> (forall c a b. (c -> (a, b)) -> f c -> (f a, f b))
-> (forall a b. f (a, b) -> (f a, f b))
-> Unzip f
unzip :: forall a b. Array1D (a, b) -> (Array1D a, Array1D b)
$cunzip :: forall a b. Array1D (a, b) -> (Array1D a, Array1D b)
unzipWith :: forall c a b. (c -> (a, b)) -> Array1D c -> (Array1D a, Array1D b)
$cunzipWith :: forall c a b. (c -> (a, b)) -> Array1D c -> (Array1D a, Array1D b)
Unzip, Semialign Array1D
Semialign Array1D
-> (forall a b. Array1D a -> Array1D b -> Array1D (a, b))
-> (forall a b c.
(a -> b -> c) -> Array1D a -> Array1D b -> Array1D c)
-> Zip Array1D
forall a b. Array1D a -> Array1D b -> Array1D (a, b)
forall a b c. (a -> b -> c) -> Array1D a -> Array1D b -> Array1D c
forall (f :: * -> *).
Semialign f
-> (forall a b. f a -> f b -> f (a, b))
-> (forall a b c. (a -> b -> c) -> f a -> f b -> f c)
-> Zip f
zipWith :: forall a b c. (a -> b -> c) -> Array1D a -> Array1D b -> Array1D c
$czipWith :: forall a b c. (a -> b -> c) -> Array1D a -> Array1D b -> Array1D c
zip :: forall a b. Array1D a -> Array1D b -> Array1D (a, b)
$czip :: forall a b. Array1D a -> Array1D b -> Array1D (a, b)
Zip
)
instance Alt Array1D where
<!> :: forall a. Array1D a -> Array1D a -> Array1D a
(<!>) = Array1D a -> Array1D a -> Array1D a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
(<|>)
getArray1D :: Array1D a -> [a]
getArray1D :: forall a. Array1D a -> [a]
getArray1D (Array1D [a]
a) = [a]
a
type IsArray1D :: Type -> Bool
type family IsArray1D a where
IsArray1D (Array1D _) = 'True
IsArray1D _ = 'False
array1DTypeInformation :: IsArray1D (Unnullify a) ~ 'False
=> Nullity a
-> TypeInformation (Unnullify a)
-> TypeInformation (Array1D a)
array1DTypeInformation :: forall a.
(IsArray1D (Unnullify a) ~ 'False) =>
Nullity a
-> TypeInformation (Unnullify a) -> TypeInformation (Array1D a)
array1DTypeInformation Nullity a
nullity TypeInformation (Unnullify a)
info =
case TypeInformation (Unnullify a)
info of
TypeInformation{ Unnullify a -> PrimExpr
encode :: forall a. TypeInformation a -> a -> PrimExpr
encode :: Unnullify a -> PrimExpr
encode, Value (Unnullify a)
decode :: forall a. TypeInformation a -> Value a
decode :: Value (Unnullify a)
decode, String
typeName :: forall a. TypeInformation a -> String
typeName :: String
typeName } -> TypeInformation :: forall a. (a -> PrimExpr) -> Value a -> String -> TypeInformation a
TypeInformation
{ decode :: Value (Array1D a)
decode = case Nullity a
nullity of
Nullity a
Null -> [Maybe (Unnullify a)] -> Array1D (Maybe (Unnullify a))
forall a. [a] -> Array1D a
Array1D ([Maybe (Unnullify a)] -> Array1D (Maybe (Unnullify a)))
-> Value [Maybe (Unnullify a)]
-> Value (Array1D (Maybe (Unnullify a)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> NullableOrNot Value (Maybe (Unnullify a))
-> Value [Maybe (Unnullify a)]
forall element. NullableOrNot Value element -> Value [element]
Hasql.listArray (Value (Unnullify a) -> NullableOrNot Value (Maybe (Unnullify a))
forall (decoder :: * -> *) a.
decoder a -> NullableOrNot decoder (Maybe a)
Hasql.nullable Value (Unnullify a)
decode)
Nullity a
NotNull -> [a] -> Array1D a
forall a. [a] -> Array1D a
Array1D ([a] -> Array1D a) -> Value [a] -> Value (Array1D a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> NullableOrNot Value a -> Value [a]
forall element. NullableOrNot Value element -> Value [element]
Hasql.listArray (Value a -> NullableOrNot Value a
forall (decoder :: * -> *) a. decoder a -> NullableOrNot decoder a
Hasql.nonNullable Value a
Value (Unnullify a)
decode)
, encode :: Array1D a -> PrimExpr
encode = case Nullity a
nullity of
Nullity a
Null -> [PrimExpr] -> PrimExpr
Opaleye.ArrayExpr ([PrimExpr] -> PrimExpr)
-> (Array1D (Maybe (Unnullify a)) -> [PrimExpr])
-> Array1D (Maybe (Unnullify a))
-> PrimExpr
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Maybe (Unnullify a) -> PrimExpr)
-> [Maybe (Unnullify a)] -> [PrimExpr]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (PrimExpr
-> (Unnullify a -> PrimExpr) -> Maybe (Unnullify a) -> PrimExpr
forall b a. b -> (a -> b) -> Maybe a -> b
maybe PrimExpr
null Unnullify a -> PrimExpr
encode) ([Maybe (Unnullify a)] -> [PrimExpr])
-> (Array1D (Maybe (Unnullify a)) -> [Maybe (Unnullify a)])
-> Array1D (Maybe (Unnullify a))
-> [PrimExpr]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Array1D (Maybe (Unnullify a)) -> [Maybe (Unnullify a)]
forall a. Array1D a -> [a]
getArray1D
Nullity a
NotNull -> [PrimExpr] -> PrimExpr
Opaleye.ArrayExpr ([PrimExpr] -> PrimExpr)
-> (Array1D a -> [PrimExpr]) -> Array1D a -> PrimExpr
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> PrimExpr) -> [a] -> [PrimExpr]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> PrimExpr
Unnullify a -> PrimExpr
encode ([a] -> [PrimExpr])
-> (Array1D a -> [a]) -> Array1D a -> [PrimExpr]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Array1D a -> [a]
forall a. Array1D a -> [a]
getArray1D
, typeName :: String
typeName = String
typeName String -> ShowS
forall a. Semigroup a => a -> a -> a
<> String
"[]"
}
where
null :: PrimExpr
null = Literal -> PrimExpr
Opaleye.ConstExpr Literal
Opaleye.NullLit
instance (Sql DBType a, IsArray1D (Unnullify a) ~ 'False) => DBType (Array1D a) where
typeInformation :: TypeInformation (Array1D a)
typeInformation = Nullity a
-> TypeInformation (Unnullify a) -> TypeInformation (Array1D a)
forall a.
(IsArray1D (Unnullify a) ~ 'False) =>
Nullity a
-> TypeInformation (Unnullify a) -> TypeInformation (Array1D a)
array1DTypeInformation Nullity a
forall a. Nullable a => Nullity a
nullable TypeInformation (Unnullify a)
forall a. DBType a => TypeInformation a
typeInformation
instance (Sql DBEq a, IsArray1D (Unnullify a) ~ 'False) => DBEq (Array1D a)
instance (Sql DBOrd a, IsArray1D (Unnullify a) ~ 'False) => DBOrd (Array1D a)
instance (Sql DBMax a, IsArray1D (Unnullify a) ~ 'False) => DBMax (Array1D a)
instance (Sql DBMin a, IsArray1D (Unnullify a) ~ 'False) => DBMin (Array1D a)
instance (Sql DBType a, IsArray1D (Unnullify a) ~ 'False) => DBSemigroup (Array1D a) where
<>. :: Expr (Array1D a) -> Expr (Array1D a) -> Expr (Array1D a)
(<>.) = (PrimExpr -> PrimExpr -> PrimExpr)
-> Expr (Array1D a) -> Expr (Array1D a) -> Expr (Array1D a)
forall a b c.
(PrimExpr -> PrimExpr -> PrimExpr) -> Expr a -> Expr b -> Expr c
zipPrimExprsWith (BinOp -> PrimExpr -> PrimExpr -> PrimExpr
Opaleye.BinExpr BinOp
(Opaleye.:||))
instance (Sql DBType a, IsArray1D (Unnullify a) ~ 'False) => DBMonoid (Array1D a) where
memptyExpr :: Expr (Array1D a)
memptyExpr = Array1D a -> Expr (Array1D a)
forall a. Sql DBType a => a -> Expr a
litExpr Array1D a
forall a. Monoid a => a
mempty