简体   繁体   English

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

[英]Haskell-Stack failing to build project with DateTime dependency despite entry in stack.yaml

So I'm trying to add this package: datetime-0.3.1 and I added what I think is the correct reference in the stack.yaml file. 因此,我尝试添加此程序包: datetime-0.3.1,并在stack.yaml文件中添加了我认为是正确的引用。 I tried using stack solver but that doesn't seem exist anymore. 我尝试使用堆栈求解器,但似乎不再存在。 I also looked for some equivalent of pip so I could just do stack install datetime-0.3.1 or something similar but that doesn't appear to be something stack does. 我还寻找了一些等价的pip,因此我可以进行堆栈安装datetime-0.3.1或类似的操作,但这似乎不是堆栈所做的。

The code: 编码:

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
}

The error I'm getting: 我得到的错误:

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.

My stack.yaml file: 我的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. stack install is mostly used for installing binaries globally, not for project-specific packages. stack install主要用于全局安装二进制文件,而不用于特定于项目的软件包。

  2. You probably want to use the time package, not datetime . 您可能要使用time包,而不是datetime as the former is actively maintained. 因为前者是积极维护的。 Moreover, in your case, time is present in LTS-13.24, so you shouldn't need to add it to extra-deps. 此外,在您的情况下,LTS-13.24中存在时间 ,因此您无需将其添加到特快运动中。 The extra-deps field is only for dependencies (including transitive ones) which are not present in your resolver. extra-deps字段仅用于解析器中不存在的依赖项(包括传递性)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM