{-|
Module: Squeal.PostgreSQL.Type
Description: types
Copyright: (c) Eitan Chatav, 2010
Maintainer: eitan@morphism.tech
Stability: experimental

storage newtypes
-}
{-# LANGUAGE
    AllowAmbiguousTypes
  , DeriveAnyClass
  , DeriveFoldable
  , DeriveFunctor
  , DeriveGeneric
  , DeriveTraversable
  , DerivingStrategies
  , DefaultSignatures
  , FlexibleContexts
  , FlexibleInstances
  , FunctionalDependencies
  , GADTs
  , LambdaCase
  , MultiParamTypeClasses
  , OverloadedStrings
  , ScopedTypeVariables
  , TypeApplications
  , TypeFamilies
  , TypeInType
  , TypeOperators
  , UndecidableInstances
  , UndecidableSuperClasses
#-}

module Squeal.PostgreSQL.Type
  ( -- * Storage newtypes
    Money (..)
  , Json (..)
  , Jsonb (..)
  , Composite (..)
  , Enumerated (..)
  , VarArray (..)
  , FixArray (..)
  , VarChar, varChar, getVarChar
  , FixChar, fixChar, getFixChar
  , Only (..)
  ) where

import Data.Proxy
import Data.Int (Int64)
import GHC.TypeLits

import qualified Data.Text as Strict (Text)
import qualified Data.Text as Strict.Text
import qualified GHC.Generics as GHC
import qualified Generics.SOP as SOP

-- $setup
-- >>> import Squeal.PostgreSQL

{- | The `Money` newtype stores a monetary value in terms
of the number of cents, i.e. @$2,000.20@ would be expressed as
@Money { cents = 200020 }@.

>>> :kind! PG Money
PG Money :: PGType
= 'PGmoney
-}
newtype Money = Money { Money -> Int64
cents :: Int64 }
  deriving stock (Money -> Money -> Bool
(Money -> Money -> Bool) -> (Money -> Money -> Bool) -> Eq Money
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Money -> Money -> Bool
$c/= :: Money -> Money -> Bool
== :: Money -> Money -> Bool
$c== :: Money -> Money -> Bool
Eq, Eq Money
Eq Money
-> (Money -> Money -> Ordering)
-> (Money -> Money -> Bool)
-> (Money -> Money -> Bool)
-> (Money -> Money -> Bool)
-> (Money -> Money -> Bool)
-> (Money -> Money -> Money)
-> (Money -> Money -> Money)
-> Ord Money
Money -> Money -> Bool
Money -> Money -> Ordering
Money -> Money -> Money
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
min :: Money -> Money -> Money
$cmin :: Money -> Money -> Money
max :: Money -> Money -> Money
$cmax :: Money -> Money -> Money
>= :: Money -> Money -> Bool
$c>= :: Money -> Money -> Bool
> :: Money -> Money -> Bool
$c> :: Money -> Money -> Bool
<= :: Money -> Money -> Bool
$c<= :: Money -> Money -> Bool
< :: Money -> Money -> Bool
$c< :: Money -> Money -> Bool
compare :: Money -> Money -> Ordering
$ccompare :: Money -> Money -> Ordering
$cp1Ord :: Eq Money
Ord, Int -> Money -> ShowS
[Money] -> ShowS
Money -> String
(Int -> Money -> ShowS)
-> (Money -> String) -> ([Money] -> ShowS) -> Show Money
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Money] -> ShowS
$cshowList :: [Money] -> ShowS
show :: Money -> String
$cshow :: Money -> String
showsPrec :: Int -> Money -> ShowS
$cshowsPrec :: Int -> Money -> ShowS
Show, ReadPrec [Money]
ReadPrec Money
Int -> ReadS Money
ReadS [Money]
(Int -> ReadS Money)
-> ReadS [Money]
-> ReadPrec Money
-> ReadPrec [Money]
-> Read Money
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Money]
$creadListPrec :: ReadPrec [Money]
readPrec :: ReadPrec Money
$creadPrec :: ReadPrec Money
readList :: ReadS [Money]
$creadList :: ReadS [Money]
readsPrec :: Int -> ReadS Money
$creadsPrec :: Int -> ReadS Money
Read, (forall x. Money -> Rep Money x)
-> (forall x. Rep Money x -> Money) -> Generic Money
forall x. Rep Money x -> Money
forall x. Money -> Rep Money x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Money x -> Money
$cfrom :: forall x. Money -> Rep Money x
GHC.Generic)
  deriving anyclass (Generic Money
Generic Money
-> (forall (proxy :: * -> *).
    proxy Money -> DatatypeInfo (Code Money))
-> HasDatatypeInfo Money
forall a.
Generic a
-> (forall (proxy :: * -> *). proxy a -> DatatypeInfo (Code a))
-> HasDatatypeInfo a
forall (proxy :: * -> *). proxy Money -> DatatypeInfo (Code Money)
datatypeInfo :: proxy Money -> DatatypeInfo (Code Money)
$cdatatypeInfo :: forall (proxy :: * -> *). proxy Money -> DatatypeInfo (Code Money)
$cp1HasDatatypeInfo :: Generic Money
SOP.HasDatatypeInfo, All SListI (Code Money)
All SListI (Code Money)
-> (Money -> Rep Money) -> (Rep Money -> Money) -> Generic Money
Rep Money -> Money
Money -> Rep Money
forall a.
All SListI (Code a) -> (a -> Rep a) -> (Rep a -> a) -> Generic a
to :: Rep Money -> Money
$cto :: Rep Money -> Money
from :: Money -> Rep Money
$cfrom :: Money -> Rep Money
$cp1Generic :: All SListI (Code Money)
SOP.Generic)

{- | The `Json` newtype is an indication that the Haskell
type it's applied to should be stored as a
`Squeal.PostgreSQL.Type.Schema.PGjson`.

>>> :kind! PG (Json [String])
PG (Json [String]) :: PGType
= 'PGjson
-}
newtype Json hask = Json {Json hask -> hask
getJson :: hask}
  deriving stock (Json hask -> Json hask -> Bool
(Json hask -> Json hask -> Bool)
-> (Json hask -> Json hask -> Bool) -> Eq (Json hask)
forall hask. Eq hask => Json hask -> Json hask -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Json hask -> Json hask -> Bool
$c/= :: forall hask. Eq hask => Json hask -> Json hask -> Bool
== :: Json hask -> Json hask -> Bool
$c== :: forall hask. Eq hask => Json hask -> Json hask -> Bool
Eq, Eq (Json hask)
Eq (Json hask)
-> (Json hask -> Json hask -> Ordering)
-> (Json hask -> Json hask -> Bool)
-> (Json hask -> Json hask -> Bool)
-> (Json hask -> Json hask -> Bool)
-> (Json hask -> Json hask -> Bool)
-> (Json hask -> Json hask -> Json hask)
-> (Json hask -> Json hask -> Json hask)
-> Ord (Json hask)
Json hask -> Json hask -> Bool
Json hask -> Json hask -> Ordering
Json hask -> Json hask -> Json hask
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 hask. Ord hask => Eq (Json hask)
forall hask. Ord hask => Json hask -> Json hask -> Bool
forall hask. Ord hask => Json hask -> Json hask -> Ordering
forall hask. Ord hask => Json hask -> Json hask -> Json hask
min :: Json hask -> Json hask -> Json hask
$cmin :: forall hask. Ord hask => Json hask -> Json hask -> Json hask
max :: Json hask -> Json hask -> Json hask
$cmax :: forall hask. Ord hask => Json hask -> Json hask -> Json hask
>= :: Json hask -> Json hask -> Bool
$c>= :: forall hask. Ord hask => Json hask -> Json hask -> Bool
> :: Json hask -> Json hask -> Bool
$c> :: forall hask. Ord hask => Json hask -> Json hask -> Bool
<= :: Json hask -> Json hask -> Bool
$c<= :: forall hask. Ord hask => Json hask -> Json hask -> Bool
< :: Json hask -> Json hask -> Bool
$c< :: forall hask. Ord hask => Json hask -> Json hask -> Bool
compare :: Json hask -> Json hask -> Ordering
$ccompare :: forall hask. Ord hask => Json hask -> Json hask -> Ordering
$cp1Ord :: forall hask. Ord hask => Eq (Json hask)
Ord, Int -> Json hask -> ShowS
[Json hask] -> ShowS
Json hask -> String
(Int -> Json hask -> ShowS)
-> (Json hask -> String)
-> ([Json hask] -> ShowS)
-> Show (Json hask)
forall hask. Show hask => Int -> Json hask -> ShowS
forall hask. Show hask => [Json hask] -> ShowS
forall hask. Show hask => Json hask -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Json hask] -> ShowS
$cshowList :: forall hask. Show hask => [Json hask] -> ShowS
show :: Json hask -> String
$cshow :: forall hask. Show hask => Json hask -> String
showsPrec :: Int -> Json hask -> ShowS
$cshowsPrec :: forall hask. Show hask => Int -> Json hask -> ShowS
Show, ReadPrec [Json hask]
ReadPrec (Json hask)
Int -> ReadS (Json hask)
ReadS [Json hask]
(Int -> ReadS (Json hask))
-> ReadS [Json hask]
-> ReadPrec (Json hask)
-> ReadPrec [Json hask]
-> Read (Json hask)
forall hask. Read hask => ReadPrec [Json hask]
forall hask. Read hask => ReadPrec (Json hask)
forall hask. Read hask => Int -> ReadS (Json hask)
forall hask. Read hask => ReadS [Json hask]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Json hask]
$creadListPrec :: forall hask. Read hask => ReadPrec [Json hask]
readPrec :: ReadPrec (Json hask)
$creadPrec :: forall hask. Read hask => ReadPrec (Json hask)
readList :: ReadS [Json hask]
$creadList :: forall hask. Read hask => ReadS [Json hask]
readsPrec :: Int -> ReadS (Json hask)
$creadsPrec :: forall hask. Read hask => Int -> ReadS (Json hask)
Read, (forall x. Json hask -> Rep (Json hask) x)
-> (forall x. Rep (Json hask) x -> Json hask)
-> Generic (Json hask)
forall x. Rep (Json hask) x -> Json hask
forall x. Json hask -> Rep (Json hask) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall hask x. Rep (Json hask) x -> Json hask
forall hask x. Json hask -> Rep (Json hask) x
$cto :: forall hask x. Rep (Json hask) x -> Json hask
$cfrom :: forall hask x. Json hask -> Rep (Json hask) x
GHC.Generic)
  deriving anyclass (Generic (Json hask)
Generic (Json hask)
-> (forall (proxy :: * -> *).
    proxy (Json hask) -> DatatypeInfo (Code (Json hask)))
-> HasDatatypeInfo (Json hask)
forall hask. Generic (Json hask)
forall a.
Generic a
-> (forall (proxy :: * -> *). proxy a -> DatatypeInfo (Code a))
-> HasDatatypeInfo a
forall hask (proxy :: * -> *).
proxy (Json hask) -> DatatypeInfo (Code (Json hask))
forall (proxy :: * -> *).
proxy (Json hask) -> DatatypeInfo (Code (Json hask))
datatypeInfo :: proxy (Json hask) -> DatatypeInfo (Code (Json hask))
$cdatatypeInfo :: forall hask (proxy :: * -> *).
proxy (Json hask) -> DatatypeInfo (Code (Json hask))
$cp1HasDatatypeInfo :: forall hask. Generic (Json hask)
SOP.HasDatatypeInfo, All SListI (Code (Json hask))
All SListI (Code (Json hask))
-> (Json hask -> Rep (Json hask))
-> (Rep (Json hask) -> Json hask)
-> Generic (Json hask)
Rep (Json hask) -> Json hask
Json hask -> Rep (Json hask)
forall hask. All SListI (Code (Json hask))
forall a.
All SListI (Code a) -> (a -> Rep a) -> (Rep a -> a) -> Generic a
forall hask. Rep (Json hask) -> Json hask
forall hask. Json hask -> Rep (Json hask)
to :: Rep (Json hask) -> Json hask
$cto :: forall hask. Rep (Json hask) -> Json hask
from :: Json hask -> Rep (Json hask)
$cfrom :: forall hask. Json hask -> Rep (Json hask)
$cp1Generic :: forall hask. All SListI (Code (Json hask))
SOP.Generic)

{- | The `Jsonb` newtype is an indication that the Haskell
type it's applied to should be stored as a
`Squeal.PostgreSQL.Type.Schema.PGjsonb`.

>>> :kind! PG (Jsonb [String])
PG (Jsonb [String]) :: PGType
= 'PGjsonb
-}
newtype Jsonb hask = Jsonb {Jsonb hask -> hask
getJsonb :: hask}
  deriving stock (Jsonb hask -> Jsonb hask -> Bool
(Jsonb hask -> Jsonb hask -> Bool)
-> (Jsonb hask -> Jsonb hask -> Bool) -> Eq (Jsonb hask)
forall hask. Eq hask => Jsonb hask -> Jsonb hask -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Jsonb hask -> Jsonb hask -> Bool
$c/= :: forall hask. Eq hask => Jsonb hask -> Jsonb hask -> Bool
== :: Jsonb hask -> Jsonb hask -> Bool
$c== :: forall hask. Eq hask => Jsonb hask -> Jsonb hask -> Bool
Eq, Eq (Jsonb hask)
Eq (Jsonb hask)
-> (Jsonb hask -> Jsonb hask -> Ordering)
-> (Jsonb hask -> Jsonb hask -> Bool)
-> (Jsonb hask -> Jsonb hask -> Bool)
-> (Jsonb hask -> Jsonb hask -> Bool)
-> (Jsonb hask -> Jsonb hask -> Bool)
-> (Jsonb hask -> Jsonb hask -> Jsonb hask)
-> (Jsonb hask -> Jsonb hask -> Jsonb hask)
-> Ord (Jsonb hask)
Jsonb hask -> Jsonb hask -> Bool
Jsonb hask -> Jsonb hask -> Ordering
Jsonb hask -> Jsonb hask -> Jsonb hask
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 hask. Ord hask => Eq (Jsonb hask)
forall hask. Ord hask => Jsonb hask -> Jsonb hask -> Bool
forall hask. Ord hask => Jsonb hask -> Jsonb hask -> Ordering
forall hask. Ord hask => Jsonb hask -> Jsonb hask -> Jsonb hask
min :: Jsonb hask -> Jsonb hask -> Jsonb hask
$cmin :: forall hask. Ord hask => Jsonb hask -> Jsonb hask -> Jsonb hask
max :: Jsonb hask -> Jsonb hask -> Jsonb hask
$cmax :: forall hask. Ord hask => Jsonb hask -> Jsonb hask -> Jsonb hask
>= :: Jsonb hask -> Jsonb hask -> Bool
$c>= :: forall hask. Ord hask => Jsonb hask -> Jsonb hask -> Bool
> :: Jsonb hask -> Jsonb hask -> Bool
$c> :: forall hask. Ord hask => Jsonb hask -> Jsonb hask -> Bool
<= :: Jsonb hask -> Jsonb hask -> Bool
$c<= :: forall hask. Ord hask => Jsonb hask -> Jsonb hask -> Bool
< :: Jsonb hask -> Jsonb hask -> Bool
$c< :: forall hask. Ord hask => Jsonb hask -> Jsonb hask -> Bool
compare :: Jsonb hask -> Jsonb hask -> Ordering
$ccompare :: forall hask. Ord hask => Jsonb hask -> Jsonb hask -> Ordering
$cp1Ord :: forall hask. Ord hask => Eq (Jsonb hask)
Ord, Int -> Jsonb hask -> ShowS
[Jsonb hask] -> ShowS
Jsonb hask -> String
(Int -> Jsonb hask -> ShowS)
-> (Jsonb hask -> String)
-> ([Jsonb hask] -> ShowS)
-> Show (Jsonb hask)
forall hask. Show hask => Int -> Jsonb hask -> ShowS
forall hask. Show hask => [Jsonb hask] -> ShowS
forall hask. Show hask => Jsonb hask -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Jsonb hask] -> ShowS
$cshowList :: forall hask. Show hask => [Jsonb hask] -> ShowS
show :: Jsonb hask -> String
$cshow :: forall hask. Show hask => Jsonb hask -> String
showsPrec :: Int -> Jsonb hask -> ShowS
$cshowsPrec :: forall hask. Show hask => Int -> Jsonb hask -> ShowS
Show, ReadPrec [Jsonb hask]
ReadPrec (Jsonb hask)
Int -> ReadS (Jsonb hask)
ReadS [Jsonb hask]
(Int -> ReadS (Jsonb hask))
-> ReadS [Jsonb hask]
-> ReadPrec (Jsonb hask)
-> ReadPrec [Jsonb hask]
-> Read (Jsonb hask)
forall hask. Read hask => ReadPrec [Jsonb hask]
forall hask. Read hask => ReadPrec (Jsonb hask)
forall hask. Read hask => Int -> ReadS (Jsonb hask)
forall hask. Read hask => ReadS [Jsonb hask]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Jsonb hask]
$creadListPrec :: forall hask. Read hask => ReadPrec [Jsonb hask]
readPrec :: ReadPrec (Jsonb hask)
$creadPrec :: forall hask. Read hask => ReadPrec (Jsonb hask)
readList :: ReadS [Jsonb hask]
$creadList :: forall hask. Read hask => ReadS [Jsonb hask]
readsPrec :: Int -> ReadS (Jsonb hask)
$creadsPrec :: forall hask. Read hask => Int -> ReadS (Jsonb hask)
Read, (forall x. Jsonb hask -> Rep (Jsonb hask) x)
-> (forall x. Rep (Jsonb hask) x -> Jsonb hask)
-> Generic (Jsonb hask)
forall x. Rep (Jsonb hask) x -> Jsonb hask
forall x. Jsonb hask -> Rep (Jsonb hask) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall hask x. Rep (Jsonb hask) x -> Jsonb hask
forall hask x. Jsonb hask -> Rep (Jsonb hask) x
$cto :: forall hask x. Rep (Jsonb hask) x -> Jsonb hask
$cfrom :: forall hask x. Jsonb hask -> Rep (Jsonb hask) x
GHC.Generic)
  deriving anyclass (Generic (Jsonb hask)
Generic (Jsonb hask)
-> (forall (proxy :: * -> *).
    proxy (Jsonb hask) -> DatatypeInfo (Code (Jsonb hask)))
-> HasDatatypeInfo (Jsonb hask)
forall hask. Generic (Jsonb hask)
forall a.
Generic a
-> (forall (proxy :: * -> *). proxy a -> DatatypeInfo (Code a))
-> HasDatatypeInfo a
forall hask (proxy :: * -> *).
proxy (Jsonb hask) -> DatatypeInfo (Code (Jsonb hask))
forall (proxy :: * -> *).
proxy (Jsonb hask) -> DatatypeInfo (Code (Jsonb hask))
datatypeInfo :: proxy (Jsonb hask) -> DatatypeInfo (Code (Jsonb hask))
$cdatatypeInfo :: forall hask (proxy :: * -> *).
proxy (Jsonb hask) -> DatatypeInfo (Code (Jsonb hask))
$cp1HasDatatypeInfo :: forall hask. Generic (Jsonb hask)
SOP.HasDatatypeInfo, All SListI (Code (Jsonb hask))
All SListI (Code (Jsonb hask))
-> (Jsonb hask -> Rep (Jsonb hask))
-> (Rep (Jsonb hask) -> Jsonb hask)
-> Generic (Jsonb hask)
Rep (Jsonb hask) -> Jsonb hask
Jsonb hask -> Rep (Jsonb hask)
forall hask. All SListI (Code (Jsonb hask))
forall a.
All SListI (Code a) -> (a -> Rep a) -> (Rep a -> a) -> Generic a
forall hask. Rep (Jsonb hask) -> Jsonb hask
forall hask. Jsonb hask -> Rep (Jsonb hask)
to :: Rep (Jsonb hask) -> Jsonb hask
$cto :: forall hask. Rep (Jsonb hask) -> Jsonb hask
from :: Jsonb hask -> Rep (Jsonb hask)
$cfrom :: forall hask. Jsonb hask -> Rep (Jsonb hask)
$cp1Generic :: forall hask. All SListI (Code (Jsonb hask))
SOP.Generic)

{- | The `Composite` newtype is an indication that the Haskell
type it's applied to should be stored as a
`Squeal.PostgreSQL.Type.Schema.PGcomposite`.

>>> :{
data Complex = Complex
  { real :: Double
  , imaginary :: Double
  } deriving stock GHC.Generic
    deriving anyclass (SOP.Generic, SOP.HasDatatypeInfo)
:}

>>> :kind! PG (Composite Complex)
PG (Composite Complex) :: PGType
= 'PGcomposite
    '["real" ::: 'NotNull 'PGfloat8,
      "imaginary" ::: 'NotNull 'PGfloat8]
-}
newtype Composite record = Composite {Composite record -> record
getComposite :: record}
  deriving stock (Composite record -> Composite record -> Bool
(Composite record -> Composite record -> Bool)
-> (Composite record -> Composite record -> Bool)
-> Eq (Composite record)
forall record.
Eq record =>
Composite record -> Composite record -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Composite record -> Composite record -> Bool
$c/= :: forall record.
Eq record =>
Composite record -> Composite record -> Bool
== :: Composite record -> Composite record -> Bool
$c== :: forall record.
Eq record =>
Composite record -> Composite record -> Bool
Eq, Eq (Composite record)
Eq (Composite record)
-> (Composite record -> Composite record -> Ordering)
-> (Composite record -> Composite record -> Bool)
-> (Composite record -> Composite record -> Bool)
-> (Composite record -> Composite record -> Bool)
-> (Composite record -> Composite record -> Bool)
-> (Composite record -> Composite record -> Composite record)
-> (Composite record -> Composite record -> Composite record)
-> Ord (Composite record)
Composite record -> Composite record -> Bool
Composite record -> Composite record -> Ordering
Composite record -> Composite record -> Composite record
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 record. Ord record => Eq (Composite record)
forall record.
Ord record =>
Composite record -> Composite record -> Bool
forall record.
Ord record =>
Composite record -> Composite record -> Ordering
forall record.
Ord record =>
Composite record -> Composite record -> Composite record
min :: Composite record -> Composite record -> Composite record
$cmin :: forall record.
Ord record =>
Composite record -> Composite record -> Composite record
max :: Composite record -> Composite record -> Composite record
$cmax :: forall record.
Ord record =>
Composite record -> Composite record -> Composite record
>= :: Composite record -> Composite record -> Bool
$c>= :: forall record.
Ord record =>
Composite record -> Composite record -> Bool
> :: Composite record -> Composite record -> Bool
$c> :: forall record.
Ord record =>
Composite record -> Composite record -> Bool
<= :: Composite record -> Composite record -> Bool
$c<= :: forall record.
Ord record =>
Composite record -> Composite record -> Bool
< :: Composite record -> Composite record -> Bool
$c< :: forall record.
Ord record =>
Composite record -> Composite record -> Bool
compare :: Composite record -> Composite record -> Ordering
$ccompare :: forall record.
Ord record =>
Composite record -> Composite record -> Ordering
$cp1Ord :: forall record. Ord record => Eq (Composite record)
Ord, Int -> Composite record -> ShowS
[Composite record] -> ShowS
Composite record -> String
(Int -> Composite record -> ShowS)
-> (Composite record -> String)
-> ([Composite record] -> ShowS)
-> Show (Composite record)
forall record. Show record => Int -> Composite record -> ShowS
forall record. Show record => [Composite record] -> ShowS
forall record. Show record => Composite record -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Composite record] -> ShowS
$cshowList :: forall record. Show record => [Composite record] -> ShowS
show :: Composite record -> String
$cshow :: forall record. Show record => Composite record -> String
showsPrec :: Int -> Composite record -> ShowS
$cshowsPrec :: forall record. Show record => Int -> Composite record -> ShowS
Show, ReadPrec [Composite record]
ReadPrec (Composite record)
Int -> ReadS (Composite record)
ReadS [Composite record]
(Int -> ReadS (Composite record))
-> ReadS [Composite record]
-> ReadPrec (Composite record)
-> ReadPrec [Composite record]
-> Read (Composite record)
forall record. Read record => ReadPrec [Composite record]
forall record. Read record => ReadPrec (Composite record)
forall record. Read record => Int -> ReadS (Composite record)
forall record. Read record => ReadS [Composite record]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Composite record]
$creadListPrec :: forall record. Read record => ReadPrec [Composite record]
readPrec :: ReadPrec (Composite record)
$creadPrec :: forall record. Read record => ReadPrec (Composite record)
readList :: ReadS [Composite record]
$creadList :: forall record. Read record => ReadS [Composite record]
readsPrec :: Int -> ReadS (Composite record)
$creadsPrec :: forall record. Read record => Int -> ReadS (Composite record)
Read, (forall x. Composite record -> Rep (Composite record) x)
-> (forall x. Rep (Composite record) x -> Composite record)
-> Generic (Composite record)
forall x. Rep (Composite record) x -> Composite record
forall x. Composite record -> Rep (Composite record) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall record x. Rep (Composite record) x -> Composite record
forall record x. Composite record -> Rep (Composite record) x
$cto :: forall record x. Rep (Composite record) x -> Composite record
$cfrom :: forall record x. Composite record -> Rep (Composite record) x
GHC.Generic)
  deriving anyclass (Generic (Composite record)
Generic (Composite record)
-> (forall (proxy :: * -> *).
    proxy (Composite record) -> DatatypeInfo (Code (Composite record)))
-> HasDatatypeInfo (Composite record)
forall record. Generic (Composite record)
forall a.
Generic a
-> (forall (proxy :: * -> *). proxy a -> DatatypeInfo (Code a))
-> HasDatatypeInfo a
forall record (proxy :: * -> *).
proxy (Composite record) -> DatatypeInfo (Code (Composite record))
forall (proxy :: * -> *).
proxy (Composite record) -> DatatypeInfo (Code (Composite record))
datatypeInfo :: proxy (Composite record) -> DatatypeInfo (Code (Composite record))
$cdatatypeInfo :: forall record (proxy :: * -> *).
proxy (Composite record) -> DatatypeInfo (Code (Composite record))
$cp1HasDatatypeInfo :: forall record. Generic (Composite record)
SOP.HasDatatypeInfo, All SListI (Code (Composite record))
All SListI (Code (Composite record))
-> (Composite record -> Rep (Composite record))
-> (Rep (Composite record) -> Composite record)
-> Generic (Composite record)
Rep (Composite record) -> Composite record
Composite record -> Rep (Composite record)
forall record. All SListI (Code (Composite record))
forall a.
All SListI (Code a) -> (a -> Rep a) -> (Rep a -> a) -> Generic a
forall record. Rep (Composite record) -> Composite record
forall record. Composite record -> Rep (Composite record)
to :: Rep (Composite record) -> Composite record
$cto :: forall record. Rep (Composite record) -> Composite record
from :: Composite record -> Rep (Composite record)
$cfrom :: forall record. Composite record -> Rep (Composite record)
$cp1Generic :: forall record. All SListI (Code (Composite record))
SOP.Generic)

{- | The `Enumerated` newtype is an indication that the Haskell
type it's applied to should be stored as a
`Squeal.PostgreSQL.Type.Schema.PGenum`.

>>> :kind! PG (Enumerated Ordering)
PG (Enumerated Ordering) :: PGType
= 'PGenum '["LT", "EQ", "GT"]
-}
newtype Enumerated enum = Enumerated {Enumerated enum -> enum
getEnumerated :: enum}
  deriving stock (Enumerated enum -> Enumerated enum -> Bool
(Enumerated enum -> Enumerated enum -> Bool)
-> (Enumerated enum -> Enumerated enum -> Bool)
-> Eq (Enumerated enum)
forall enum. Eq enum => Enumerated enum -> Enumerated enum -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Enumerated enum -> Enumerated enum -> Bool
$c/= :: forall enum. Eq enum => Enumerated enum -> Enumerated enum -> Bool
== :: Enumerated enum -> Enumerated enum -> Bool
$c== :: forall enum. Eq enum => Enumerated enum -> Enumerated enum -> Bool
Eq, Eq (Enumerated enum)
Eq (Enumerated enum)
-> (Enumerated enum -> Enumerated enum -> Ordering)
-> (Enumerated enum -> Enumerated enum -> Bool)
-> (Enumerated enum -> Enumerated enum -> Bool)
-> (Enumerated enum -> Enumerated enum -> Bool)
-> (Enumerated enum -> Enumerated enum -> Bool)
-> (Enumerated enum -> Enumerated enum -> Enumerated enum)
-> (Enumerated enum -> Enumerated enum -> Enumerated enum)
-> Ord (Enumerated enum)
Enumerated enum -> Enumerated enum -> Bool
Enumerated enum -> Enumerated enum -> Ordering
Enumerated enum -> Enumerated enum -> Enumerated enum
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 enum. Ord enum => Eq (Enumerated enum)
forall enum. Ord enum => Enumerated enum -> Enumerated enum -> Bool
forall enum.
Ord enum =>
Enumerated enum -> Enumerated enum -> Ordering
forall enum.
Ord enum =>
Enumerated enum -> Enumerated enum -> Enumerated enum
min :: Enumerated enum -> Enumerated enum -> Enumerated enum
$cmin :: forall enum.
Ord enum =>
Enumerated enum -> Enumerated enum -> Enumerated enum
max :: Enumerated enum -> Enumerated enum -> Enumerated enum
$cmax :: forall enum.
Ord enum =>
Enumerated enum -> Enumerated enum -> Enumerated enum
>= :: Enumerated enum -> Enumerated enum -> Bool
$c>= :: forall enum. Ord enum => Enumerated enum -> Enumerated enum -> Bool
> :: Enumerated enum -> Enumerated enum -> Bool
$c> :: forall enum. Ord enum => Enumerated enum -> Enumerated enum -> Bool
<= :: Enumerated enum -> Enumerated enum -> Bool
$c<= :: forall enum. Ord enum => Enumerated enum -> Enumerated enum -> Bool
< :: Enumerated enum -> Enumerated enum -> Bool
$c< :: forall enum. Ord enum => Enumerated enum -> Enumerated enum -> Bool
compare :: Enumerated enum -> Enumerated enum -> Ordering
$ccompare :: forall enum.
Ord enum =>
Enumerated enum -> Enumerated enum -> Ordering
$cp1Ord :: forall enum. Ord enum => Eq (Enumerated enum)
Ord, Int -> Enumerated enum -> ShowS
[Enumerated enum] -> ShowS
Enumerated enum -> String
(Int -> Enumerated enum -> ShowS)
-> (Enumerated enum -> String)
-> ([Enumerated enum] -> ShowS)
-> Show (Enumerated enum)
forall enum. Show enum => Int -> Enumerated enum -> ShowS
forall enum. Show enum => [Enumerated enum] -> ShowS
forall enum. Show enum => Enumerated enum -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Enumerated enum] -> ShowS
$cshowList :: forall enum. Show enum => [Enumerated enum] -> ShowS
show :: Enumerated enum -> String
$cshow :: forall enum. Show enum => Enumerated enum -> String
showsPrec :: Int -> Enumerated enum -> ShowS
$cshowsPrec :: forall enum. Show enum => Int -> Enumerated enum -> ShowS
Show, ReadPrec [Enumerated enum]
ReadPrec (Enumerated enum)
Int -> ReadS (Enumerated enum)
ReadS [Enumerated enum]
(Int -> ReadS (Enumerated enum))
-> ReadS [Enumerated enum]
-> ReadPrec (Enumerated enum)
-> ReadPrec [Enumerated enum]
-> Read (Enumerated enum)
forall enum. Read enum => ReadPrec [Enumerated enum]
forall enum. Read enum => ReadPrec (Enumerated enum)
forall enum. Read enum => Int -> ReadS (Enumerated enum)
forall enum. Read enum => ReadS [Enumerated enum]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Enumerated enum]
$creadListPrec :: forall enum. Read enum => ReadPrec [Enumerated enum]
readPrec :: ReadPrec (Enumerated enum)
$creadPrec :: forall enum. Read enum => ReadPrec (Enumerated enum)
readList :: ReadS [Enumerated enum]
$creadList :: forall enum. Read enum => ReadS [Enumerated enum]
readsPrec :: Int -> ReadS (Enumerated enum)
$creadsPrec :: forall enum. Read enum => Int -> ReadS (Enumerated enum)
Read, (forall x. Enumerated enum -> Rep (Enumerated enum) x)
-> (forall x. Rep (Enumerated enum) x -> Enumerated enum)
-> Generic (Enumerated enum)
forall x. Rep (Enumerated enum) x -> Enumerated enum
forall x. Enumerated enum -> Rep (Enumerated enum) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall enum x. Rep (Enumerated enum) x -> Enumerated enum
forall enum x. Enumerated enum -> Rep (Enumerated enum) x
$cto :: forall enum x. Rep (Enumerated enum) x -> Enumerated enum
$cfrom :: forall enum x. Enumerated enum -> Rep (Enumerated enum) x
GHC.Generic)
  deriving anyclass (Generic (Enumerated enum)
Generic (Enumerated enum)
-> (forall (proxy :: * -> *).
    proxy (Enumerated enum) -> DatatypeInfo (Code (Enumerated enum)))
-> HasDatatypeInfo (Enumerated enum)
forall enum. Generic (Enumerated enum)
forall a.
Generic a
-> (forall (proxy :: * -> *). proxy a -> DatatypeInfo (Code a))
-> HasDatatypeInfo a
forall enum (proxy :: * -> *).
proxy (Enumerated enum) -> DatatypeInfo (Code (Enumerated enum))
forall (proxy :: * -> *).
proxy (Enumerated enum) -> DatatypeInfo (Code (Enumerated enum))
datatypeInfo :: proxy (Enumerated enum) -> DatatypeInfo (Code (Enumerated enum))
$cdatatypeInfo :: forall enum (proxy :: * -> *).
proxy (Enumerated enum) -> DatatypeInfo (Code (Enumerated enum))
$cp1HasDatatypeInfo :: forall enum. Generic (Enumerated enum)
SOP.HasDatatypeInfo, All SListI (Code (Enumerated enum))
All SListI (Code (Enumerated enum))
-> (Enumerated enum -> Rep (Enumerated enum))
-> (Rep (Enumerated enum) -> Enumerated enum)
-> Generic (Enumerated enum)
Rep (Enumerated enum) -> Enumerated enum
Enumerated enum -> Rep (Enumerated enum)
forall enum. All SListI (Code (Enumerated enum))
forall a.
All SListI (Code a) -> (a -> Rep a) -> (Rep a -> a) -> Generic a
forall enum. Rep (Enumerated enum) -> Enumerated enum
forall enum. Enumerated enum -> Rep (Enumerated enum)
to :: Rep (Enumerated enum) -> Enumerated enum
$cto :: forall enum. Rep (Enumerated enum) -> Enumerated enum
from :: Enumerated enum -> Rep (Enumerated enum)
$cfrom :: forall enum. Enumerated enum -> Rep (Enumerated enum)
$cp1Generic :: forall enum. All SListI (Code (Enumerated enum))
SOP.Generic)

{- | The `VarArray` newtype is an indication that the Haskell
type it's applied to should be stored as a
`Squeal.PostgreSQL.Type.Schema.PGvararray`.

>>> import Data.Vector
>>> :kind! PG (VarArray (Vector Double))
PG (VarArray (Vector Double)) :: PGType
= 'PGvararray ('NotNull 'PGfloat8)
-}
newtype VarArray arr
  = VarArray {VarArray arr -> arr
getVarArray :: arr}
  deriving stock (VarArray arr -> VarArray arr -> Bool
(VarArray arr -> VarArray arr -> Bool)
-> (VarArray arr -> VarArray arr -> Bool) -> Eq (VarArray arr)
forall arr. Eq arr => VarArray arr -> VarArray arr -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VarArray arr -> VarArray arr -> Bool
$c/= :: forall arr. Eq arr => VarArray arr -> VarArray arr -> Bool
== :: VarArray arr -> VarArray arr -> Bool
$c== :: forall arr. Eq arr => VarArray arr -> VarArray arr -> Bool
Eq, Eq (VarArray arr)
Eq (VarArray arr)
-> (VarArray arr -> VarArray arr -> Ordering)
-> (VarArray arr -> VarArray arr -> Bool)
-> (VarArray arr -> VarArray arr -> Bool)
-> (VarArray arr -> VarArray arr -> Bool)
-> (VarArray arr -> VarArray arr -> Bool)
-> (VarArray arr -> VarArray arr -> VarArray arr)
-> (VarArray arr -> VarArray arr -> VarArray arr)
-> Ord (VarArray arr)
VarArray arr -> VarArray arr -> Bool
VarArray arr -> VarArray arr -> Ordering
VarArray arr -> VarArray arr -> VarArray arr
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 arr. Ord arr => Eq (VarArray arr)
forall arr. Ord arr => VarArray arr -> VarArray arr -> Bool
forall arr. Ord arr => VarArray arr -> VarArray arr -> Ordering
forall arr. Ord arr => VarArray arr -> VarArray arr -> VarArray arr
min :: VarArray arr -> VarArray arr -> VarArray arr
$cmin :: forall arr. Ord arr => VarArray arr -> VarArray arr -> VarArray arr
max :: VarArray arr -> VarArray arr -> VarArray arr
$cmax :: forall arr. Ord arr => VarArray arr -> VarArray arr -> VarArray arr
>= :: VarArray arr -> VarArray arr -> Bool
$c>= :: forall arr. Ord arr => VarArray arr -> VarArray arr -> Bool
> :: VarArray arr -> VarArray arr -> Bool
$c> :: forall arr. Ord arr => VarArray arr -> VarArray arr -> Bool
<= :: VarArray arr -> VarArray arr -> Bool
$c<= :: forall arr. Ord arr => VarArray arr -> VarArray arr -> Bool
< :: VarArray arr -> VarArray arr -> Bool
$c< :: forall arr. Ord arr => VarArray arr -> VarArray arr -> Bool
compare :: VarArray arr -> VarArray arr -> Ordering
$ccompare :: forall arr. Ord arr => VarArray arr -> VarArray arr -> Ordering
$cp1Ord :: forall arr. Ord arr => Eq (VarArray arr)
Ord, Int -> VarArray arr -> ShowS
[VarArray arr] -> ShowS
VarArray arr -> String
(Int -> VarArray arr -> ShowS)
-> (VarArray arr -> String)
-> ([VarArray arr] -> ShowS)
-> Show (VarArray arr)
forall arr. Show arr => Int -> VarArray arr -> ShowS
forall arr. Show arr => [VarArray arr] -> ShowS
forall arr. Show arr => VarArray arr -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VarArray arr] -> ShowS
$cshowList :: forall arr. Show arr => [VarArray arr] -> ShowS
show :: VarArray arr -> String
$cshow :: forall arr. Show arr => VarArray arr -> String
showsPrec :: Int -> VarArray arr -> ShowS
$cshowsPrec :: forall arr. Show arr => Int -> VarArray arr -> ShowS
Show, ReadPrec [VarArray arr]
ReadPrec (VarArray arr)
Int -> ReadS (VarArray arr)
ReadS [VarArray arr]
(Int -> ReadS (VarArray arr))
-> ReadS [VarArray arr]
-> ReadPrec (VarArray arr)
-> ReadPrec [VarArray arr]
-> Read (VarArray arr)
forall arr. Read arr => ReadPrec [VarArray arr]
forall arr. Read arr => ReadPrec (VarArray arr)
forall arr. Read arr => Int -> ReadS (VarArray arr)
forall arr. Read arr => ReadS [VarArray arr]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VarArray arr]
$creadListPrec :: forall arr. Read arr => ReadPrec [VarArray arr]
readPrec :: ReadPrec (VarArray arr)
$creadPrec :: forall arr. Read arr => ReadPrec (VarArray arr)
readList :: ReadS [VarArray arr]
$creadList :: forall arr. Read arr => ReadS [VarArray arr]
readsPrec :: Int -> ReadS (VarArray arr)
$creadsPrec :: forall arr. Read arr => Int -> ReadS (VarArray arr)
Read, (forall x. VarArray arr -> Rep (VarArray arr) x)
-> (forall x. Rep (VarArray arr) x -> VarArray arr)
-> Generic (VarArray arr)
forall x. Rep (VarArray arr) x -> VarArray arr
forall x. VarArray arr -> Rep (VarArray arr) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall arr x. Rep (VarArray arr) x -> VarArray arr
forall arr x. VarArray arr -> Rep (VarArray arr) x
$cto :: forall arr x. Rep (VarArray arr) x -> VarArray arr
$cfrom :: forall arr x. VarArray arr -> Rep (VarArray arr) x
GHC.Generic)
  deriving anyclass (Generic (VarArray arr)
Generic (VarArray arr)
-> (forall (proxy :: * -> *).
    proxy (VarArray arr) -> DatatypeInfo (Code (VarArray arr)))
-> HasDatatypeInfo (VarArray arr)
forall arr. Generic (VarArray arr)
forall a.
Generic a
-> (forall (proxy :: * -> *). proxy a -> DatatypeInfo (Code a))
-> HasDatatypeInfo a
forall arr (proxy :: * -> *).
proxy (VarArray arr) -> DatatypeInfo (Code (VarArray arr))
forall (proxy :: * -> *).
proxy (VarArray arr) -> DatatypeInfo (Code (VarArray arr))
datatypeInfo :: proxy (VarArray arr) -> DatatypeInfo (Code (VarArray arr))
$cdatatypeInfo :: forall arr (proxy :: * -> *).
proxy (VarArray arr) -> DatatypeInfo (Code (VarArray arr))
$cp1HasDatatypeInfo :: forall arr. Generic (VarArray arr)
SOP.HasDatatypeInfo, All SListI (Code (VarArray arr))
All SListI (Code (VarArray arr))
-> (VarArray arr -> Rep (VarArray arr))
-> (Rep (VarArray arr) -> VarArray arr)
-> Generic (VarArray arr)
Rep (VarArray arr) -> VarArray arr
VarArray arr -> Rep (VarArray arr)
forall arr. All SListI (Code (VarArray arr))
forall a.
All SListI (Code a) -> (a -> Rep a) -> (Rep a -> a) -> Generic a
forall arr. Rep (VarArray arr) -> VarArray arr
forall arr. VarArray arr -> Rep (VarArray arr)
to :: Rep (VarArray arr) -> VarArray arr
$cto :: forall arr. Rep (VarArray arr) -> VarArray arr
from :: VarArray arr -> Rep (VarArray arr)
$cfrom :: forall arr. VarArray arr -> Rep (VarArray arr)
$cp1Generic :: forall arr. All SListI (Code (VarArray arr))
SOP.Generic)

{- | The `FixArray` newtype is an indication that the Haskell
type it's applied to should be stored as a
`Squeal.PostgreSQL.Type.Schema.PGfixarray`.

>>> :kind! PG (FixArray ((Double, Double), (Double, Double)))
PG (FixArray ((Double, Double), (Double, Double))) :: PGType
= 'PGfixarray '[2, 2] ('NotNull 'PGfloat8)
-}
newtype FixArray arr = FixArray {FixArray arr -> arr
getFixArray :: arr}
  deriving stock (FixArray arr -> FixArray arr -> Bool
(FixArray arr -> FixArray arr -> Bool)
-> (FixArray arr -> FixArray arr -> Bool) -> Eq (FixArray arr)
forall arr. Eq arr => FixArray arr -> FixArray arr -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FixArray arr -> FixArray arr -> Bool
$c/= :: forall arr. Eq arr => FixArray arr -> FixArray arr -> Bool
== :: FixArray arr -> FixArray arr -> Bool
$c== :: forall arr. Eq arr => FixArray arr -> FixArray arr -> Bool
Eq, Eq (FixArray arr)
Eq (FixArray arr)
-> (FixArray arr -> FixArray arr -> Ordering)
-> (FixArray arr -> FixArray arr -> Bool)
-> (FixArray arr -> FixArray arr -> Bool)
-> (FixArray arr -> FixArray arr -> Bool)
-> (FixArray arr -> FixArray arr -> Bool)
-> (FixArray arr -> FixArray arr -> FixArray arr)
-> (FixArray arr -> FixArray arr -> FixArray arr)
-> Ord (FixArray arr)
FixArray arr -> FixArray arr -> Bool
FixArray arr -> FixArray arr -> Ordering
FixArray arr -> FixArray arr -> FixArray arr
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 arr. Ord arr => Eq (FixArray arr)
forall arr. Ord arr => FixArray arr -> FixArray arr -> Bool
forall arr. Ord arr => FixArray arr -> FixArray arr -> Ordering
forall arr. Ord arr => FixArray arr -> FixArray arr -> FixArray arr
min :: FixArray arr -> FixArray arr -> FixArray arr
$cmin :: forall arr. Ord arr => FixArray arr -> FixArray arr -> FixArray arr
max :: FixArray arr -> FixArray arr -> FixArray arr
$cmax :: forall arr. Ord arr => FixArray arr -> FixArray arr -> FixArray arr
>= :: FixArray arr -> FixArray arr -> Bool
$c>= :: forall arr. Ord arr => FixArray arr -> FixArray arr -> Bool
> :: FixArray arr -> FixArray arr -> Bool
$c> :: forall arr. Ord arr => FixArray arr -> FixArray arr -> Bool
<= :: FixArray arr -> FixArray arr -> Bool
$c<= :: forall arr. Ord arr => FixArray arr -> FixArray arr -> Bool
< :: FixArray arr -> FixArray arr -> Bool
$c< :: forall arr. Ord arr => FixArray arr -> FixArray arr -> Bool
compare :: FixArray arr -> FixArray arr -> Ordering
$ccompare :: forall arr. Ord arr => FixArray arr -> FixArray arr -> Ordering
$cp1Ord :: forall arr. Ord arr => Eq (FixArray arr)
Ord, Int -> FixArray arr -> ShowS
[FixArray arr] -> ShowS
FixArray arr -> String
(Int -> FixArray arr -> ShowS)
-> (FixArray arr -> String)
-> ([FixArray arr] -> ShowS)
-> Show (FixArray arr)
forall arr. Show arr => Int -> FixArray arr -> ShowS
forall arr. Show arr => [FixArray arr] -> ShowS
forall arr. Show arr => FixArray arr -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FixArray arr] -> ShowS
$cshowList :: forall arr. Show arr => [FixArray arr] -> ShowS
show :: FixArray arr -> String
$cshow :: forall arr. Show arr => FixArray arr -> String
showsPrec :: Int -> FixArray arr -> ShowS
$cshowsPrec :: forall arr. Show arr => Int -> FixArray arr -> ShowS
Show, ReadPrec [FixArray arr]
ReadPrec (FixArray arr)
Int -> ReadS (FixArray arr)
ReadS [FixArray arr]
(Int -> ReadS (FixArray arr))
-> ReadS [FixArray arr]
-> ReadPrec (FixArray arr)
-> ReadPrec [FixArray arr]
-> Read (FixArray arr)
forall arr. Read arr => ReadPrec [FixArray arr]
forall arr. Read arr => ReadPrec (FixArray arr)
forall arr. Read arr => Int -> ReadS (FixArray arr)
forall arr. Read arr => ReadS [FixArray arr]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FixArray arr]
$creadListPrec :: forall arr. Read arr => ReadPrec [FixArray arr]
readPrec :: ReadPrec (FixArray arr)
$creadPrec :: forall arr. Read arr => ReadPrec (FixArray arr)
readList :: ReadS [FixArray arr]
$creadList :: forall arr. Read arr => ReadS [FixArray arr]
readsPrec :: Int -> ReadS (FixArray arr)
$creadsPrec :: forall arr. Read arr => Int -> ReadS (FixArray arr)
Read, (forall x. FixArray arr -> Rep (FixArray arr) x)
-> (forall x. Rep (FixArray arr) x -> FixArray arr)
-> Generic (FixArray arr)
forall x. Rep (FixArray arr) x -> FixArray arr
forall x. FixArray arr -> Rep (FixArray arr) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall arr x. Rep (FixArray arr) x -> FixArray arr
forall arr x. FixArray arr -> Rep (FixArray arr) x
$cto :: forall arr x. Rep (FixArray arr) x -> FixArray arr
$cfrom :: forall arr x. FixArray arr -> Rep (FixArray arr) x
GHC.Generic)
  deriving anyclass (Generic (FixArray arr)
Generic (FixArray arr)
-> (forall (proxy :: * -> *).
    proxy (FixArray arr) -> DatatypeInfo (Code (FixArray arr)))
-> HasDatatypeInfo (FixArray arr)
forall arr. Generic (FixArray arr)
forall a.
Generic a
-> (forall (proxy :: * -> *). proxy a -> DatatypeInfo (Code a))
-> HasDatatypeInfo a
forall arr (proxy :: * -> *).
proxy (FixArray arr) -> DatatypeInfo (Code (FixArray arr))
forall (proxy :: * -> *).
proxy (FixArray arr) -> DatatypeInfo (Code (FixArray arr))
datatypeInfo :: proxy (FixArray arr) -> DatatypeInfo (Code (FixArray arr))
$cdatatypeInfo :: forall arr (proxy :: * -> *).
proxy (FixArray arr) -> DatatypeInfo (Code (FixArray arr))
$cp1HasDatatypeInfo :: forall arr. Generic (FixArray arr)
SOP.HasDatatypeInfo, All SListI (Code (FixArray arr))
All SListI (Code (FixArray arr))
-> (FixArray arr -> Rep (FixArray arr))
-> (Rep (FixArray arr) -> FixArray arr)
-> Generic (FixArray arr)
Rep (FixArray arr) -> FixArray arr
FixArray arr -> Rep (FixArray arr)
forall arr. All SListI (Code (FixArray arr))
forall a.
All SListI (Code a) -> (a -> Rep a) -> (Rep a -> a) -> Generic a
forall arr. Rep (FixArray arr) -> FixArray arr
forall arr. FixArray arr -> Rep (FixArray arr)
to :: Rep (FixArray arr) -> FixArray arr
$cto :: forall arr. Rep (FixArray arr) -> FixArray arr
from :: FixArray arr -> Rep (FixArray arr)
$cfrom :: forall arr. FixArray arr -> Rep (FixArray arr)
$cp1Generic :: forall arr. All SListI (Code (FixArray arr))
SOP.Generic)

-- | `Only` is a 1-tuple type, useful for encoding or decoding a singleton
newtype Only x = Only { Only x -> x
fromOnly :: x }
  deriving (a -> Only b -> Only a
(a -> b) -> Only a -> Only b
(forall a b. (a -> b) -> Only a -> Only b)
-> (forall a b. a -> Only b -> Only a) -> Functor Only
forall a b. a -> Only b -> Only a
forall a b. (a -> b) -> Only a -> Only b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> Only b -> Only a
$c<$ :: forall a b. a -> Only b -> Only a
fmap :: (a -> b) -> Only a -> Only b
$cfmap :: forall a b. (a -> b) -> Only a -> Only b
Functor,Only a -> Bool
(a -> m) -> Only a -> m
(a -> b -> b) -> b -> Only a -> b
(forall m. Monoid m => Only m -> m)
-> (forall m a. Monoid m => (a -> m) -> Only a -> m)
-> (forall m a. Monoid m => (a -> m) -> Only a -> m)
-> (forall a b. (a -> b -> b) -> b -> Only a -> b)
-> (forall a b. (a -> b -> b) -> b -> Only a -> b)
-> (forall b a. (b -> a -> b) -> b -> Only a -> b)
-> (forall b a. (b -> a -> b) -> b -> Only a -> b)
-> (forall a. (a -> a -> a) -> Only a -> a)
-> (forall a. (a -> a -> a) -> Only a -> a)
-> (forall a. Only a -> [a])
-> (forall a. Only a -> Bool)
-> (forall a. Only a -> Int)
-> (forall a. Eq a => a -> Only a -> Bool)
-> (forall a. Ord a => Only a -> a)
-> (forall a. Ord a => Only a -> a)
-> (forall a. Num a => Only a -> a)
-> (forall a. Num a => Only a -> a)
-> Foldable Only
forall a. Eq a => a -> Only a -> Bool
forall a. Num a => Only a -> a
forall a. Ord a => Only a -> a
forall m. Monoid m => Only m -> m
forall a. Only a -> Bool
forall a. Only a -> Int
forall a. Only a -> [a]
forall a. (a -> a -> a) -> Only a -> a
forall m a. Monoid m => (a -> m) -> Only a -> m
forall b a. (b -> a -> b) -> b -> Only a -> b
forall a b. (a -> b -> b) -> b -> Only 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 :: Only a -> a
$cproduct :: forall a. Num a => Only a -> a
sum :: Only a -> a
$csum :: forall a. Num a => Only a -> a
minimum :: Only a -> a
$cminimum :: forall a. Ord a => Only a -> a
maximum :: Only a -> a
$cmaximum :: forall a. Ord a => Only a -> a
elem :: a -> Only a -> Bool
$celem :: forall a. Eq a => a -> Only a -> Bool
length :: Only a -> Int
$clength :: forall a. Only a -> Int
null :: Only a -> Bool
$cnull :: forall a. Only a -> Bool
toList :: Only a -> [a]
$ctoList :: forall a. Only a -> [a]
foldl1 :: (a -> a -> a) -> Only a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> Only a -> a
foldr1 :: (a -> a -> a) -> Only a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> Only a -> a
foldl' :: (b -> a -> b) -> b -> Only a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> Only a -> b
foldl :: (b -> a -> b) -> b -> Only a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> Only a -> b
foldr' :: (a -> b -> b) -> b -> Only a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> Only a -> b
foldr :: (a -> b -> b) -> b -> Only a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> Only a -> b
foldMap' :: (a -> m) -> Only a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> Only a -> m
foldMap :: (a -> m) -> Only a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> Only a -> m
fold :: Only m -> m
$cfold :: forall m. Monoid m => Only m -> m
Foldable,Functor Only
Foldable Only
Functor Only
-> Foldable Only
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> Only a -> f (Only b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    Only (f a) -> f (Only a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> Only a -> m (Only b))
-> (forall (m :: * -> *) a. Monad m => Only (m a) -> m (Only a))
-> Traversable Only
(a -> f b) -> Only a -> f (Only b)
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 => Only (m a) -> m (Only a)
forall (f :: * -> *) a. Applicative f => Only (f a) -> f (Only a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Only a -> m (Only b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Only a -> f (Only b)
sequence :: Only (m a) -> m (Only a)
$csequence :: forall (m :: * -> *) a. Monad m => Only (m a) -> m (Only a)
mapM :: (a -> m b) -> Only a -> m (Only b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Only a -> m (Only b)
sequenceA :: Only (f a) -> f (Only a)
$csequenceA :: forall (f :: * -> *) a. Applicative f => Only (f a) -> f (Only a)
traverse :: (a -> f b) -> Only a -> f (Only b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Only a -> f (Only b)
$cp2Traversable :: Foldable Only
$cp1Traversable :: Functor Only
Traversable,Only x -> Only x -> Bool
(Only x -> Only x -> Bool)
-> (Only x -> Only x -> Bool) -> Eq (Only x)
forall x. Eq x => Only x -> Only x -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Only x -> Only x -> Bool
$c/= :: forall x. Eq x => Only x -> Only x -> Bool
== :: Only x -> Only x -> Bool
$c== :: forall x. Eq x => Only x -> Only x -> Bool
Eq,Eq (Only x)
Eq (Only x)
-> (Only x -> Only x -> Ordering)
-> (Only x -> Only x -> Bool)
-> (Only x -> Only x -> Bool)
-> (Only x -> Only x -> Bool)
-> (Only x -> Only x -> Bool)
-> (Only x -> Only x -> Only x)
-> (Only x -> Only x -> Only x)
-> Ord (Only x)
Only x -> Only x -> Bool
Only x -> Only x -> Ordering
Only x -> Only x -> Only x
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 x. Ord x => Eq (Only x)
forall x. Ord x => Only x -> Only x -> Bool
forall x. Ord x => Only x -> Only x -> Ordering
forall x. Ord x => Only x -> Only x -> Only x
min :: Only x -> Only x -> Only x
$cmin :: forall x. Ord x => Only x -> Only x -> Only x
max :: Only x -> Only x -> Only x
$cmax :: forall x. Ord x => Only x -> Only x -> Only x
>= :: Only x -> Only x -> Bool
$c>= :: forall x. Ord x => Only x -> Only x -> Bool
> :: Only x -> Only x -> Bool
$c> :: forall x. Ord x => Only x -> Only x -> Bool
<= :: Only x -> Only x -> Bool
$c<= :: forall x. Ord x => Only x -> Only x -> Bool
< :: Only x -> Only x -> Bool
$c< :: forall x. Ord x => Only x -> Only x -> Bool
compare :: Only x -> Only x -> Ordering
$ccompare :: forall x. Ord x => Only x -> Only x -> Ordering
$cp1Ord :: forall x. Ord x => Eq (Only x)
Ord,ReadPrec [Only x]
ReadPrec (Only x)
Int -> ReadS (Only x)
ReadS [Only x]
(Int -> ReadS (Only x))
-> ReadS [Only x]
-> ReadPrec (Only x)
-> ReadPrec [Only x]
-> Read (Only x)
forall x. Read x => ReadPrec [Only x]
forall x. Read x => ReadPrec (Only x)
forall x. Read x => Int -> ReadS (Only x)
forall x. Read x => ReadS [Only x]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Only x]
$creadListPrec :: forall x. Read x => ReadPrec [Only x]
readPrec :: ReadPrec (Only x)
$creadPrec :: forall x. Read x => ReadPrec (Only x)
readList :: ReadS [Only x]
$creadList :: forall x. Read x => ReadS [Only x]
readsPrec :: Int -> ReadS (Only x)
$creadsPrec :: forall x. Read x => Int -> ReadS (Only x)
Read,Int -> Only x -> ShowS
[Only x] -> ShowS
Only x -> String
(Int -> Only x -> ShowS)
-> (Only x -> String) -> ([Only x] -> ShowS) -> Show (Only x)
forall x. Show x => Int -> Only x -> ShowS
forall x. Show x => [Only x] -> ShowS
forall x. Show x => Only x -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Only x] -> ShowS
$cshowList :: forall x. Show x => [Only x] -> ShowS
show :: Only x -> String
$cshow :: forall x. Show x => Only x -> String
showsPrec :: Int -> Only x -> ShowS
$cshowsPrec :: forall x. Show x => Int -> Only x -> ShowS
Show,(forall x. Only x -> Rep (Only x) x)
-> (forall x. Rep (Only x) x -> Only x) -> Generic (Only x)
forall x. Rep (Only x) x -> Only x
forall x. Only x -> Rep (Only x) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall x x. Rep (Only x) x -> Only x
forall x x. Only x -> Rep (Only x) x
$cto :: forall x x. Rep (Only x) x -> Only x
$cfrom :: forall x x. Only x -> Rep (Only x) x
GHC.Generic)
instance SOP.Generic (Only x)
instance SOP.HasDatatypeInfo (Only x)

{- | Variable-length text type with limit

>>> :kind! PG (VarChar 4)
PG (VarChar 4) :: PGType
= 'PGvarchar 4
-}
newtype VarChar (n :: Nat) = VarChar Strict.Text
  deriving (VarChar n -> VarChar n -> Bool
(VarChar n -> VarChar n -> Bool)
-> (VarChar n -> VarChar n -> Bool) -> Eq (VarChar n)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall (n :: Nat). VarChar n -> VarChar n -> Bool
/= :: VarChar n -> VarChar n -> Bool
$c/= :: forall (n :: Nat). VarChar n -> VarChar n -> Bool
== :: VarChar n -> VarChar n -> Bool
$c== :: forall (n :: Nat). VarChar n -> VarChar n -> Bool
Eq,Eq (VarChar n)
Eq (VarChar n)
-> (VarChar n -> VarChar n -> Ordering)
-> (VarChar n -> VarChar n -> Bool)
-> (VarChar n -> VarChar n -> Bool)
-> (VarChar n -> VarChar n -> Bool)
-> (VarChar n -> VarChar n -> Bool)
-> (VarChar n -> VarChar n -> VarChar n)
-> (VarChar n -> VarChar n -> VarChar n)
-> Ord (VarChar n)
VarChar n -> VarChar n -> Bool
VarChar n -> VarChar n -> Ordering
VarChar n -> VarChar n -> VarChar n
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 (n :: Nat). Eq (VarChar n)
forall (n :: Nat). VarChar n -> VarChar n -> Bool
forall (n :: Nat). VarChar n -> VarChar n -> Ordering
forall (n :: Nat). VarChar n -> VarChar n -> VarChar n
min :: VarChar n -> VarChar n -> VarChar n
$cmin :: forall (n :: Nat). VarChar n -> VarChar n -> VarChar n
max :: VarChar n -> VarChar n -> VarChar n
$cmax :: forall (n :: Nat). VarChar n -> VarChar n -> VarChar n
>= :: VarChar n -> VarChar n -> Bool
$c>= :: forall (n :: Nat). VarChar n -> VarChar n -> Bool
> :: VarChar n -> VarChar n -> Bool
$c> :: forall (n :: Nat). VarChar n -> VarChar n -> Bool
<= :: VarChar n -> VarChar n -> Bool
$c<= :: forall (n :: Nat). VarChar n -> VarChar n -> Bool
< :: VarChar n -> VarChar n -> Bool
$c< :: forall (n :: Nat). VarChar n -> VarChar n -> Bool
compare :: VarChar n -> VarChar n -> Ordering
$ccompare :: forall (n :: Nat). VarChar n -> VarChar n -> Ordering
$cp1Ord :: forall (n :: Nat). Eq (VarChar n)
Ord,ReadPrec [VarChar n]
ReadPrec (VarChar n)
Int -> ReadS (VarChar n)
ReadS [VarChar n]
(Int -> ReadS (VarChar n))
-> ReadS [VarChar n]
-> ReadPrec (VarChar n)
-> ReadPrec [VarChar n]
-> Read (VarChar n)
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
forall (n :: Nat). ReadPrec [VarChar n]
forall (n :: Nat). ReadPrec (VarChar n)
forall (n :: Nat). Int -> ReadS (VarChar n)
forall (n :: Nat). ReadS [VarChar n]
readListPrec :: ReadPrec [VarChar n]
$creadListPrec :: forall (n :: Nat). ReadPrec [VarChar n]
readPrec :: ReadPrec (VarChar n)
$creadPrec :: forall (n :: Nat). ReadPrec (VarChar n)
readList :: ReadS [VarChar n]
$creadList :: forall (n :: Nat). ReadS [VarChar n]
readsPrec :: Int -> ReadS (VarChar n)
$creadsPrec :: forall (n :: Nat). Int -> ReadS (VarChar n)
Read,Int -> VarChar n -> ShowS
[VarChar n] -> ShowS
VarChar n -> String
(Int -> VarChar n -> ShowS)
-> (VarChar n -> String)
-> ([VarChar n] -> ShowS)
-> Show (VarChar n)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall (n :: Nat). Int -> VarChar n -> ShowS
forall (n :: Nat). [VarChar n] -> ShowS
forall (n :: Nat). VarChar n -> String
showList :: [VarChar n] -> ShowS
$cshowList :: forall (n :: Nat). [VarChar n] -> ShowS
show :: VarChar n -> String
$cshow :: forall (n :: Nat). VarChar n -> String
showsPrec :: Int -> VarChar n -> ShowS
$cshowsPrec :: forall (n :: Nat). Int -> VarChar n -> ShowS
Show)

-- | Constructor for `VarChar`
varChar :: forall  n . KnownNat n => Strict.Text -> Maybe (VarChar n)
varChar :: Text -> Maybe (VarChar n)
varChar Text
t =
  if Text -> Int
Strict.Text.length Text
t Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
<= Integer -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Proxy n -> Integer
forall (n :: Nat) (proxy :: Nat -> *).
KnownNat n =>
proxy n -> Integer
natVal @n Proxy n
forall k (t :: k). Proxy t
Proxy)
  then VarChar n -> Maybe (VarChar n)
forall a. a -> Maybe a
Just (VarChar n -> Maybe (VarChar n)) -> VarChar n -> Maybe (VarChar n)
forall a b. (a -> b) -> a -> b
$ Text -> VarChar n
forall (n :: Nat). Text -> VarChar n
VarChar Text
t
  else Maybe (VarChar n)
forall a. Maybe a
Nothing

-- | Access the `Strict.Text` of a `VarChar`
getVarChar :: VarChar n -> Strict.Text
getVarChar :: VarChar n -> Text
getVarChar (VarChar Text
t) = Text
t

{- | Fixed-length, blank padded

>>> :kind! PG (FixChar 4)
PG (FixChar 4) :: PGType
= 'PGchar 4
-}
newtype FixChar (n :: Nat) = FixChar Strict.Text
  deriving (FixChar n -> FixChar n -> Bool
(FixChar n -> FixChar n -> Bool)
-> (FixChar n -> FixChar n -> Bool) -> Eq (FixChar n)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall (n :: Nat). FixChar n -> FixChar n -> Bool
/= :: FixChar n -> FixChar n -> Bool
$c/= :: forall (n :: Nat). FixChar n -> FixChar n -> Bool
== :: FixChar n -> FixChar n -> Bool
$c== :: forall (n :: Nat). FixChar n -> FixChar n -> Bool
Eq,Eq (FixChar n)
Eq (FixChar n)
-> (FixChar n -> FixChar n -> Ordering)
-> (FixChar n -> FixChar n -> Bool)
-> (FixChar n -> FixChar n -> Bool)
-> (FixChar n -> FixChar n -> Bool)
-> (FixChar n -> FixChar n -> Bool)
-> (FixChar n -> FixChar n -> FixChar n)
-> (FixChar n -> FixChar n -> FixChar n)
-> Ord (FixChar n)
FixChar n -> FixChar n -> Bool
FixChar n -> FixChar n -> Ordering
FixChar n -> FixChar n -> FixChar n
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 (n :: Nat). Eq (FixChar n)
forall (n :: Nat). FixChar n -> FixChar n -> Bool
forall (n :: Nat). FixChar n -> FixChar n -> Ordering
forall (n :: Nat). FixChar n -> FixChar n -> FixChar n
min :: FixChar n -> FixChar n -> FixChar n
$cmin :: forall (n :: Nat). FixChar n -> FixChar n -> FixChar n
max :: FixChar n -> FixChar n -> FixChar n
$cmax :: forall (n :: Nat). FixChar n -> FixChar n -> FixChar n
>= :: FixChar n -> FixChar n -> Bool
$c>= :: forall (n :: Nat). FixChar n -> FixChar n -> Bool
> :: FixChar n -> FixChar n -> Bool
$c> :: forall (n :: Nat). FixChar n -> FixChar n -> Bool
<= :: FixChar n -> FixChar n -> Bool
$c<= :: forall (n :: Nat). FixChar n -> FixChar n -> Bool
< :: FixChar n -> FixChar n -> Bool
$c< :: forall (n :: Nat). FixChar n -> FixChar n -> Bool
compare :: FixChar n -> FixChar n -> Ordering
$ccompare :: forall (n :: Nat). FixChar n -> FixChar n -> Ordering
$cp1Ord :: forall (n :: Nat). Eq (FixChar n)
Ord,ReadPrec [FixChar n]
ReadPrec (FixChar n)
Int -> ReadS (FixChar n)
ReadS [FixChar n]
(Int -> ReadS (FixChar n))
-> ReadS [FixChar n]
-> ReadPrec (FixChar n)
-> ReadPrec [FixChar n]
-> Read (FixChar n)
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
forall (n :: Nat). ReadPrec [FixChar n]
forall (n :: Nat). ReadPrec (FixChar n)
forall (n :: Nat). Int -> ReadS (FixChar n)
forall (n :: Nat). ReadS [FixChar n]
readListPrec :: ReadPrec [FixChar n]
$creadListPrec :: forall (n :: Nat). ReadPrec [FixChar n]
readPrec :: ReadPrec (FixChar n)
$creadPrec :: forall (n :: Nat). ReadPrec (FixChar n)
readList :: ReadS [FixChar n]
$creadList :: forall (n :: Nat). ReadS [FixChar n]
readsPrec :: Int -> ReadS (FixChar n)
$creadsPrec :: forall (n :: Nat). Int -> ReadS (FixChar n)
Read,Int -> FixChar n -> ShowS
[FixChar n] -> ShowS
FixChar n -> String
(Int -> FixChar n -> ShowS)
-> (FixChar n -> String)
-> ([FixChar n] -> ShowS)
-> Show (FixChar n)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall (n :: Nat). Int -> FixChar n -> ShowS
forall (n :: Nat). [FixChar n] -> ShowS
forall (n :: Nat). FixChar n -> String
showList :: [FixChar n] -> ShowS
$cshowList :: forall (n :: Nat). [FixChar n] -> ShowS
show :: FixChar n -> String
$cshow :: forall (n :: Nat). FixChar n -> String
showsPrec :: Int -> FixChar n -> ShowS
$cshowsPrec :: forall (n :: Nat). Int -> FixChar n -> ShowS
Show)

-- | Constructor for `FixChar`
fixChar :: forall  n . KnownNat n => Strict.Text -> Maybe (FixChar n)
fixChar :: Text -> Maybe (FixChar n)
fixChar Text
t =
  if Text -> Int
Strict.Text.length Text
t Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Integer -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Proxy n -> Integer
forall (n :: Nat) (proxy :: Nat -> *).
KnownNat n =>
proxy n -> Integer
natVal @n Proxy n
forall k (t :: k). Proxy t
Proxy)
  then FixChar n -> Maybe (FixChar n)
forall a. a -> Maybe a
Just (FixChar n -> Maybe (FixChar n)) -> FixChar n -> Maybe (FixChar n)
forall a b. (a -> b) -> a -> b
$ Text -> FixChar n
forall (n :: Nat). Text -> FixChar n
FixChar Text
t
  else Maybe (FixChar n)
forall a. Maybe a
Nothing

-- | Access the `Strict.Text` of a `FixChar`
getFixChar :: FixChar n -> Strict.Text
getFixChar :: FixChar n -> Text
getFixChar (FixChar Text
t) = Text
t