简体   繁体   中英

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. 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.

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:

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.

  2. You probably want to use the time package, not 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. The extra-deps field is only for dependencies (including transitive ones) which are not present in your resolver.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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