mirror of
https://github.com/khibino/haskell-relational-record.git
synced 2024-12-28 22:44:11 +03:00
examples: apply DeriveGeneric.
This commit is contained in:
parent
8a0083598f
commit
b545487b97
@ -1,9 +1,10 @@
|
||||
{-# LANGUAGE TemplateHaskell, MultiParamTypeClasses, FlexibleInstances #-}
|
||||
{-# LANGUAGE TemplateHaskell, MultiParamTypeClasses, FlexibleInstances, DeriveGeneric #-}
|
||||
|
||||
module Group where
|
||||
|
||||
import GHC.Generics (Generic)
|
||||
import Prelude hiding (id)
|
||||
import PgTestDataSource (defineTable)
|
||||
|
||||
$(defineTable []
|
||||
"EXAMPLE1" "group" [''Show])
|
||||
"EXAMPLE1" "group" [''Show, ''Generic])
|
||||
|
@ -1,8 +1,9 @@
|
||||
{-# LANGUAGE TemplateHaskell, MultiParamTypeClasses, FlexibleInstances #-}
|
||||
{-# LANGUAGE TemplateHaskell, MultiParamTypeClasses, FlexibleInstances, DeriveGeneric #-}
|
||||
|
||||
module Membership where
|
||||
|
||||
import GHC.Generics (Generic)
|
||||
import PgTestDataSource (defineTable)
|
||||
|
||||
$(defineTable []
|
||||
"EXAMPLE1" "membership" [])
|
||||
"EXAMPLE1" "membership" [''Generic])
|
||||
|
@ -1,9 +1,10 @@
|
||||
{-# LANGUAGE Arrows #-}
|
||||
{-# LANGUAGE FlexibleContexts, FlexibleInstances, MultiParamTypeClasses #-}
|
||||
{-# LANGUAGE FlexibleContexts, FlexibleInstances, MultiParamTypeClasses, DeriveGeneric #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module QueryArrowExample where
|
||||
|
||||
import GHC.Generics (Generic)
|
||||
import Database.Record
|
||||
|
||||
import Database.Relational.Query.Arrow
|
||||
@ -54,7 +55,7 @@ haskUserGroup =
|
||||
returnA -< u >< mg ?! snd'
|
||||
|
||||
data UserOrGroup = UserOrGroup { mayUser :: Maybe User, mayGroup :: Maybe Group }
|
||||
deriving Show
|
||||
deriving (Show, Generic)
|
||||
|
||||
$(makeRecordPersistableDefault ''UserOrGroup)
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
{-# LANGUAGE MonadComprehensions #-}
|
||||
{-# LANGUAGE FlexibleContexts, FlexibleInstances, MultiParamTypeClasses #-}
|
||||
{-# LANGUAGE FlexibleContexts, FlexibleInstances, MultiParamTypeClasses, DeriveGeneric #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module QueryExample where
|
||||
|
||||
import GHC.Generics (Generic)
|
||||
import Database.Record
|
||||
|
||||
import Database.Relational.Query
|
||||
@ -56,7 +57,7 @@ haskUserGroup =
|
||||
]
|
||||
|
||||
data UserOrGroup = UserOrGroup { mayUser :: Maybe User, mayGroup :: Maybe Group }
|
||||
deriving Show
|
||||
deriving (Show, Generic)
|
||||
|
||||
$(makeRecordPersistableDefault ''UserOrGroup)
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
{-# LANGUAGE TemplateHaskell, MultiParamTypeClasses, FlexibleInstances #-}
|
||||
{-# LANGUAGE TemplateHaskell, MultiParamTypeClasses, FlexibleInstances, DeriveGeneric #-}
|
||||
|
||||
module User where
|
||||
|
||||
import GHC.Generics (Generic)
|
||||
import Prelude hiding (id)
|
||||
import PgTestDataSource (defineTable)
|
||||
|
||||
$(defineTable []
|
||||
"EXAMPLE1" "user" [''Show])
|
||||
"EXAMPLE1" "user" [''Show, ''Generic])
|
||||
|
@ -1,8 +1,9 @@
|
||||
{-# LANGUAGE TemplateHaskell, MultiParamTypeClasses, FlexibleInstances #-}
|
||||
{-# LANGUAGE TemplateHaskell, MultiParamTypeClasses, FlexibleInstances, DeriveGeneric #-}
|
||||
|
||||
module KeyTest where
|
||||
|
||||
import GHC.Generics (Generic)
|
||||
import PgTestDataSource (defineTable)
|
||||
|
||||
$(defineTable []
|
||||
"EXAMPLE2" "keyTest" [])
|
||||
"EXAMPLE2" "keyTest" [''Generic])
|
||||
|
@ -1,9 +1,10 @@
|
||||
{-# LANGUAGE TemplateHaskell, MultiParamTypeClasses, FlexibleInstances #-}
|
||||
{-# LANGUAGE TemplateHaskell, MultiParamTypeClasses, FlexibleInstances, DeriveGeneric #-}
|
||||
|
||||
module History where
|
||||
|
||||
import GHC.Generics (Generic)
|
||||
import Prelude hiding (seq, log)
|
||||
import PgTestDataSource (defineTable)
|
||||
|
||||
$(defineTable []
|
||||
"EXAMPLE3" "history" [''Show])
|
||||
"EXAMPLE3" "history" [''Show, ''Generic])
|
||||
|
@ -1,9 +1,10 @@
|
||||
{-# LANGUAGE TemplateHaskell, MultiParamTypeClasses, FlexibleInstances #-}
|
||||
{-# LANGUAGE TemplateHaskell, MultiParamTypeClasses, FlexibleInstances, DeriveGeneric #-}
|
||||
|
||||
module SetA where
|
||||
|
||||
import GHC.Generics (Generic)
|
||||
import Prelude hiding (seq)
|
||||
import PgTestDataSource (defineTable)
|
||||
|
||||
$(defineTable []
|
||||
"EXAMPLE3" "set_a" [''Show])
|
||||
"EXAMPLE3" "set_a" [''Show, ''Generic])
|
||||
|
@ -1,9 +1,10 @@
|
||||
{-# LANGUAGE TemplateHaskell, MultiParamTypeClasses, FlexibleInstances #-}
|
||||
{-# LANGUAGE TemplateHaskell, MultiParamTypeClasses, FlexibleInstances, DeriveGeneric #-}
|
||||
|
||||
module SetB where
|
||||
|
||||
import GHC.Generics (Generic)
|
||||
import Prelude hiding (seq)
|
||||
import PgTestDataSource (defineTable)
|
||||
|
||||
$(defineTable []
|
||||
"EXAMPLE3" "set_b" [''Show])
|
||||
"EXAMPLE3" "set_b" [''Show, ''Generic])
|
||||
|
@ -1,9 +1,10 @@
|
||||
{-# LANGUAGE TemplateHaskell, MultiParamTypeClasses, FlexibleInstances #-}
|
||||
{-# LANGUAGE TemplateHaskell, MultiParamTypeClasses, FlexibleInstances, DeriveGeneric #-}
|
||||
|
||||
module One where
|
||||
|
||||
import GHC.Generics (Generic)
|
||||
import Prelude hiding (seq)
|
||||
import PgTestDataSource (defineTable)
|
||||
|
||||
$(defineTable []
|
||||
"EXAMPLE4" "one" [''Show])
|
||||
"EXAMPLE4" "one" [''Show, ''Generic])
|
||||
|
@ -1,9 +1,10 @@
|
||||
{-# LANGUAGE TemplateHaskell, MultiParamTypeClasses, FlexibleInstances #-}
|
||||
{-# LANGUAGE TemplateHaskell, MultiParamTypeClasses, FlexibleInstances, DeriveGeneric #-}
|
||||
|
||||
module StockGoods where
|
||||
|
||||
import GHC.Generics (Generic)
|
||||
import Prelude hiding (seq)
|
||||
import PgTestDataSource (defineTable)
|
||||
|
||||
$(defineTable []
|
||||
"EXAMPLE4" "stock_goods" [''Show])
|
||||
"EXAMPLE4" "stock_goods" [''Show, ''Generic])
|
||||
|
Loading…
Reference in New Issue
Block a user