2

内部で URL を展開するための統一されたルート パスを持つ手段として、Scotty アプリケーションに Reader モナドを導入しようとしています。Scotty がモナド変換をどのように処理するかについて頭を悩ませているようにはrunTransformerT ...見えませんscottyT。、私がここにいるように)。MonadIO n => n ()IO ()main

これまでの私のコードは次のとおりです。

main :: IO ()
main = scottyT 3000
  (\x -> runReaderT x "foo.com")
  id $ do
    root <- lift ask
    get "/" $
      text root

そして、私が得ているエラー:

src/Main.hs:16:21:
    Couldn't match type ‘IO’ with ‘ReaderT r0 IO’
    Expected type: ReaderT r0 IO a
      Actual type: IO a
    In the first argument of ‘runReaderT’, namely ‘x’
    In the expression: runReaderT x "foo.com"

この魔法の使い方は?

4

0 に答える 0