Haskell-Stack尽管在stack.yaml中输入了项目,却无法构建具有DateTime依赖性的项目

时间:2019-06-28 12:59:17

标签: haskell cabal haskell-stack build-error

因此,我尝试添加以下软件包:datetime-0.3.1,并在stack.yaml文件中添加了认为是正确的引用。我尝试使用堆栈求解器,但似乎不再存在。我还寻找了一些等效的pip,所以我可以执行 stack install datetime-0.3.1 或类似的操作,但似乎不像stack那样。

代码:

module FhirDataTypes (
    FhirId (..),
    toFhirId
) where

import Data.Maybe (Maybe(..))
import Data.List (length)
import Coding as Coding
import Data.Decimal
import FhirUri (FhirUri(..))
import FhirString (FhirString(..))
import SimpleQuantity (SimpleQuantity(..))
import Data.DateTime

newtype FhirId = FhirId FhirString deriving (Show)

toFhirId :: FhirString -> Maybe FhirId
toFhirId fs@(FhirString s)
    | length s > 64 = Nothing
    | otherwise = Just $ FhirId fs

data Money = Money  { value :: Decimal
                    , currency :: Code
}

data Range = Range  {   low :: SimpleQuantity
                    ,   high :: SimpleQuantity
}

data Ratio = Ratio  {   numerator :: Quantity
                    ,   denominator :: Quantity
}

data Period = Period    { start :: DateTime
                        , end :: DateTime
}

我得到的错误:

PS C:\util\haskell\fhir-practice> stack build

Error: While constructing the build plan, the following exceptions were encountered:

In the dependencies for fhir-practice-0.1.0.0:
DateTime needed, but the stack configuration has no specified version (no package with that name found, perhaps there is a typo in
         a package's build-depends or an omission from the stack.yaml packages list?) needed since fhir-practice is a build target.

Some different approaches to resolving this:


Plan construction failed.

我的stack.yaml文件:

flags: {}
packages:
- .
extra-deps: 
- network-  uri-2.6.1.0@sha256:62cc45c66023e37ef921d5fb546aca56a9c786615e05925fb193a70bf0913690
- Decimal-0.4.2
- datetime-0.3.1
resolver: lts-13.24

1 个答案:

答案 0 :(得分:2)

  1. stack install主要用于全局安装二进制文件,而不用于特定于项目的软件包。

  2. 您可能想使用time软件包,而不是datetime。因为前者是积极维护的。此外,在您的情况下,time存在于LTS-13.24中,因此您无需将其添加到超深度。 Extra-deps字段仅用于解析器中不存在的依赖项(包括传递性)。