ScottyでWeb アプリの作成を開始しようとしていますが、サーバーを実行しようとすると依存関係の競合が発生します。これが私のコードです:
{-# LANGUAGE OverloadedStrings #-}
module Site where
import Web.Scotty
import Control.Monad.IO.Class
import qualified Data.Text.Lazy.IO as T
-- Controllers
indexController :: ActionM ()
indexController = do
index <- liftIO $ T.readFile "public/index.html"
html index
routes :: ScottyM ()
routes = do
get "/" indexController
main :: IO ()
main = do
scotty 9901 routes
を使用して実行するとrunhaskell Site.hs
、次のエラーが発生します。
Site.hs:12:10:
Couldn't match expected type `text-0.11.2.3:Data.Text.Lazy.Internal.Text'
with actual type `Data.Text.Lazy.Internal.Text'
In the first argument of `html', namely `index'
In a stmt of a 'do' block: html index
In the expression:
do { index <- liftIO $ T.readFile "public/index.html";
html index }
を使用cabal list text
すると、バージョン0.11.2.3
と0.11.3.1
がインストールされていることがわかり0.11.3.1
ますが、デフォルトです。Scotty'sは、パッケージが である必要があるとscotty.cabal
指定しています。これは、上記のコードが機能するように思えます。この種のエラーの回避策はありますか?text
>= 0.11.2.3