0

サーバントのチュートリアルに従おうとしていますが、Cabal エラーが発生しますUnknown fields: build-tool-depends。これは私のtutorial.cabalファイルです (サーバントの 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

どんな助けでも大歓迎です!

4

1 に答える 1