小编nah*_*mot的帖子

Haskell依赖冲突

我一直在尝试开始在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
Run Code Online (Sandbox Code Playgroud)

当我使用它运行时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 …
Run Code Online (Sandbox Code Playgroud)

haskell ghc cabal web

3
推荐指数
1
解决办法
369
查看次数

标签 统计

cabal ×1

ghc ×1

haskell ×1

web ×1