Skip to content

Commit 10db346

Browse files
committed
some nonce fixes
1 parent 2337f60 commit 10db346

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

pub/functora/src/prelude/Functora/Prelude.hs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,7 @@ module Functora.Prelude
119119
dropAround,
120120
dropWhileEnd,
121121
AscOrDesc (..),
122-
Nonce,
123-
unNonce,
122+
Nonce (..),
124123
NonceGen,
125124
newNonceGen,
126125
withNonce,
@@ -1168,12 +1167,14 @@ data AscOrDesc
11681167
)
11691168

11701169
newtype Nonce = Nonce
1171-
{ unNonce :: Natural
1170+
{ unNonce :: Integer
11721171
}
11731172
deriving newtype
11741173
( Eq,
11751174
Ord,
1176-
Show
1175+
Show,
1176+
Read,
1177+
Binary
11771178
)
11781179
deriving stock
11791180
( Data,
@@ -1184,6 +1185,7 @@ mkNonce :: (MonadIO m) => m Nonce
11841185
mkNonce =
11851186
liftIO
11861187
$ Nonce
1188+
. from @Natural @Integer
11871189
. utcTimeToMicros
11881190
<$> getCurrentTime
11891191

pub/functora/src/sql/Functora/SqlOrphan.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,7 @@ deriving newtype instance PersistFieldSql Fix
120120
deriving newtype instance PersistField FixNonNeg
121121

122122
deriving newtype instance PersistFieldSql FixNonNeg
123+
124+
deriving newtype instance PersistField Nonce
125+
126+
deriving newtype instance PersistFieldSql Nonce

0 commit comments

Comments
 (0)