on dev help sign in
failing test
a174b79Eitan Chatav
squeal-postgresql/src/Squeal/PostgreSQL/Binary.hs+3−1
@@ -13,6 +13,7 @@ Instances are governed by the `Generic` and `HasDatatype` typeclasses.
13>>> import Control.Monad.Base
13>>> import Control.Monad.Base
14
14
15>>> import Squeal.PostgreSQL
15>>> import Squeal.PostgreSQL
16+>>> import qualified Squeal.PostgreSQL as SQL
16
17
17>>> data Schwarma = Beef | Lamb | Chicken deriving (Show, GHC.Generic)
18>>> data Schwarma = Beef | Lamb | Chicken deriving (Show, GHC.Generic)
18>>> instance Generic Schwarma
19>>> instance Generic Schwarma
@@ -28,6 +29,7 @@ void . withConnection "host=localhost port=5432 dbname=exampledb" $ do
28:}
29:}
29Beef
30Beef
30
31
32+>>> :set -XTypeFamilies -XTypeInType -XUndecidableInstances
31>>> :{
33>>> :{
32type family Schema :: SchemaType where
34type family Schema :: SchemaType where
33 Schema =
35 Schema =
@@ -50,7 +52,7 @@ let
50 insertRow_ #tab (Set (param @1) `As` #col :* Nil)
52 insertRow_ #tab (Set (param @1) `As` #col :* Nil)
51 :: Manipulation Schema '[ 'NotNull (EnumWith Schwarma)] '[]
53 :: Manipulation Schema '[ 'NotNull (EnumWith Schwarma)] '[]
52 qry =
54 qry =
53− select (#col `As` #fromOnly :* Nil) (from (table #tab))
55+ select (#col `As` #fromOnly :* Nil) (SQL.from (table #tab))
54 :: Query Schema '[] '["fromOnly" ::: 'NotNull (EnumWith Schwarma)]
56 :: Query Schema '[] '["fromOnly" ::: 'NotNull (EnumWith Schwarma)]
55 session = do
57 session = do
56 manipulateParams manip (Only Chicken)
58 manipulateParams manip (Only Chicken)