Cabal 错误 `Unknown fields: build-tool-depends` 试图跟随 servant 教程

Cabal error `Unknown fields: build-tool-depends` trying to follow the servant tutorial

我正在尝试关注 the servant tutorial and I'm running into the Cabal error Unknown fields: build-tool-depends. This is my tutorial.cabal file (I got this from servant's github repo):

name:                tutorial
version:             0.10
synopsis:            The servant tutorial
homepage:            http://haskell-servant.readthedocs.org/
license:             BSD3
license-file:        LICENSE
author:              Servant Contributors
maintainer:          haskell-servant-maintainers@googlegroups.com
build-type:          Simple
cabal-version:       >=1.10

library
  exposed-modules:     Server
  build-depends:       base == 4.*
                     , base-compat
                     , text
                     , aeson
                     , aeson-compat
                     , blaze-html
                     , directory
                     , blaze-markup
                     , containers
                     , servant == 0.11.*
                     , servant-server == 0.11.*
                     , servant-client == 0.11.*
                     , servant-docs == 0.11.*
                     , servant-js >= 0.9 && <0.10
                     , warp
                     , http-api-data
                     , http-media
                     , lucid
                     , time
                     , string-conversions
                     , bytestring
                     , attoparsec
                     , mtl
                     , random
                     , js-jquery
                     , wai
                     , http-types
                     , transformers
                     , markdown-unlit >= 0.4
                     , http-client
  default-language:    Haskell2010
  ghc-options:         -Wall -pgmL markdown-unlit
  build-tool-depends: markdown-unlit:markdown-unlit

test-suite spec
  type: exitcode-stdio-1.0
  ghc-options: -Wall
  default-language: Haskell2010
  hs-source-dirs: test
  main-is: Spec.hs
  other-modules: JavascriptSpec
  build-depends: base == 4.*
               , tutorial
               , hspec
               , hspec-wai
               , string-conversions

cabal build 应该可以构建这个吗?这是我得到的输出:

➜  servant cabal build
Package has never been configured. Configuring with default flags. If this
fails, please run configure manually.
Warning: tutorial.cabal: Unknown fields: build-tool-depends (line 46)
Fields allowed in this section:
...

cabal --version 给出:

cabal-install version 1.24.0.2
compiled using version 1.24.2.0 of the Cabal library

我认为我的 ApiType.hs 文件与此错误无关,但以防万一:

{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeOperators #-}

module Server where

import Prelude ()
import Prelude.Compat

import Control.Monad.Except
import Control.Monad.Reader
import Data.Aeson.Compat
import Data.Aeson.Types
import Data.Attoparsec.ByteString
import Data.ByteString (ByteString)
import Data.List
import Data.Maybe
import Data.String.Conversions
import Data.Time.Calendar
import GHC.Generics
import Lucid
import Network.HTTP.Media ((//), (/:))
import Network.Wai
import Network.Wai.Handler.Warp
import Servant
import System.Directory
import Text.Blaze
import Text.Blaze.Html.Renderer.Utf8
import qualified Data.Aeson.Parser
import qualified Text.Blaze.Html

type UserAPI =
       "users" :> Get '[JSON] [User]
--  :<|> "user" :> Capture "id" Integer :> Get '[JSON] User
--  :<|> "user" :> ReqBody '[JSON] User :> Post '[JSON] User

data User = User {
  id :: Int,
  name :: String,
  age :: Int,
  email :: String,
  registration_date :: UTCTime
}

instance ToJSON User

users1 :: [User]
users1 =
  [ User 1 "Isaac Newton" 372 "isaac@newton.co.uk" (fromGregorian 1683 3 1)
  , User 2 "Albert Einstein" 136 "ae@mc2.org" (fromGregorian 1905 12 1)
  ]

server1 :: Server UserAPI
server1 = return users1

userAPI :: Proxy UserAPI
userAPI = Proxy

app1 :: Application
app1 = serve userAPI server1

main :: IO ()
main = run 8081 app1

非常欢迎任何帮助!

build-tool-depends是cabal 2.0的新领域。参见 What's new in Cabal/cabal-install 2.0

New build-tool-depends field that replaces build-tools and has a better defined semantics (#3708, #1541). cabal-install will now install required build tools and add them to PATH automatically.