问题描述
data MyAppR = MyAppR {
dbPool :: Pool Connection
}
type NewApp = ReaderT (MyAppR) IO
type AppActionNew a = ActionT L.Text NewApp a
type AppServerNew a = ScottyT L.Text NewApp a
type App = IO
type AppServer a = ScottyT L.Text App a
type AppAction a = ActionT L.Text App a
type AppActionT = ActionT L.Text App
mylift :: AppServer () -> AppServerNew ()
mylift a = undefined
将其发布,以防万一有人已经有了解决方案,否则我只是想办法解决这个问题。不幸的是ScottyT
/ ActionT
不是monad转换器,所以我不能只执行通常的举动。
整个原因是,我现在为我的应用程序需要一个数据库池,但是我不想在任何地方都更改AppServer
类型,然后在所有地方都使用。仅仅将AppServer
与AppServerNew
合并和混合可能更快。
进行类型检查的初始解决方案-但似乎无法正常工作,因为所有“处理程序”均以404响应:
mylift :: AppServer () -> AppServerNew ()
mylift (ScottyT x) = pure $ evalState x def
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)