Skip to content

Instantly share code, notes, and snippets.

@khibino
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save khibino/776c25d1470594aaf241 to your computer and use it in GitHub Desktop.
Save khibino/776c25d1470594aaf241 to your computer and use it in GitHub Desktop.
import MyTuple
import Control.Applicative
import Database.Record
import Database.Record.ToSql
import Database.Relational.Query
import Database.HDBC (SqlValue)
import Database.HDBC.Query.TH
instance ProductConstructor (a -> b -> c -> MyTuple a b c) where
productConstructor = MyTuple
instance (FromSql SqlValue a, FromSql SqlValue b, FromSql SqlValue c)
=> FromSql SqlValue (MyTuple a b c) where
recordFromSql = MyTuple <$> recordFromSql <*> recordFromSql <*> recordFromSql
instance (ToSql SqlValue a, ToSql SqlValue b, ToSql SqlValue c)
=> ToSql SqlValue (MyTuple a b c) where
recordToSql = createRecordToSql (\(MyTuple a b c) -> fromRecord a ++ fromRecord b ++ fromRecord c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment