newtype UserRegDate = UserRegDate UTCTime
deriving (Show, Read)
instance Param UserRegDate where
render (UserRegDate x) = render x
instance Result UserRegDate where
convert f m = UserRegDate $ convert f m
instance QueryResults UserRegDate where
convertResults [f] [v] = UserRegDate t
where !t = convert f v
convertResults fs vs = convertError fs vs 1
verifyCredentials :: UserCredentials -> IO (Either SignInError UserCore)
verifyCredentials (uEmail,_) = do
conn <- connectDB
e <- try (retrieve conn uEmail) :: IO (Either SomeException [UserRegDate])
close conn
return $ either (Left . SignInDatabaseError) (Right . fakeuser . head) e
where
retrieve conn mail =
query conn "select userRegDate from users where userEmail = ?" [mail]
Results in error: