on master help sign in
Switch to decimal from money.
9e378b6Nick
src/Data/Money/Rel8.hs+3−1
unifiedsplit
@@ -7,11 +7,13 @@ import Data.Money.Internal
7import Data.Scientific
7import Data.Scientific
8import Rel8
8import Rel8
9
9
10+import Debug.Trace
11+
10instance DBType (Money curr) where
12instance DBType (Money curr) where
11 typeInformation =
13 typeInformation =
12 let sci = typeInformation @Scientific
14 let sci = typeInformation @Scientific
13 in TypeInformation { encode = encode sci . realToFrac . getAmount
15 in TypeInformation { encode = encode sci . realToFrac . getAmount
14 , decode = fmap (Money . realToFrac) (decode sci)
16 , decode = fmap (Money . realToFrac) (decode sci)
15− , typeName = "money"
17+ , typeName = "decimal"
16 }
18 }
17
19
test/Rel8Spec.hs+1−1
@@ -48,7 +48,7 @@ createConnection = throwLeft =<< Hasql.acquire dbsets
48
48
49createTable :: Connection -> IO ()
49createTable :: Connection -> IO ()
50createTable conn = throwLeft =<< Hasql.run sql conn
50createTable conn = throwLeft =<< Hasql.run sql conn
51− where sql = Hasql.sql "CREATE TABLE bucks (amount money not null);"
51+ where sql = Hasql.sql "CREATE TABLE bucks (amount decimal not null);"
52
52
53dropTable :: Connection -> IO ()
53dropTable :: Connection -> IO ()
54dropTable conn = throwLeft =<< Hasql.run sql conn
54dropTable conn = throwLeft =<< Hasql.run sql conn