Cleanup type signatures and start working on debug env run

This commit is contained in:
James Eversole
2024-10-16 08:10:10 -05:00
parent 0808fe130a
commit ffec891f26
5 changed files with 77 additions and 79 deletions

View File

@@ -32,22 +32,23 @@ data AppEnv = AppEnv { pool :: Pool Connection }
newtype UserId = UserId Int
deriving (Show, Generic, FromField, ToField, FromHttpApiData, ToHttpApiData)
instance ToJSON UserId
instance FromJSON UserId
instance ToRow UserId
instance FromRow UserId
data User = User { userId :: UserId, userName :: T.Text}
deriving (Show, Generic)
instance FromRow User where
fromRow = User <$> field <*> field
instance ToRow User where
toRow (User uid name) = toRow (uid, name)
instance ToJSON UserId
instance FromJSON UserId
instance ToRow UserId
instance FromRow UserId
instance ToJSON User
instance FromJSON User
instance ToRow User where
toRow (User uid name) = toRow (uid, name)
instance FromRow User where
fromRow = User <$> field <*> field
data Database :: Effect where
DatabaseInit
:: Database (Eff es) ()
@@ -58,7 +59,7 @@ data Database :: Effect where
DatabaseWrite
:: (ToRow a, Show a) => (Query, a) -> Database (Eff es) ()
data Logger :: Effect where
data Logger :: Effect where
WriteLog :: LogLevel -> String -> Logger (Eff es) ()
data LogLevel = Info | Warning | Error