无法在Haskell中安装模块

时间:2019-10-21 03:53:30

标签: haskell odbc cabal hdbc

我正在尝试为Haskell项目安装HDBCHDBC.odbc。我从Hackage下载了模块并需要依赖,并用cabal install [module name]安装了它们。 尽管由于我在Windows上,所以确实需要为convertibleutf8依赖项使用Cygwin。

当我打电话给cabal list --installed时,我得到

* Cabal
    Synopsis: A framework for packaging Haskell software
    Default available version: 3.0.0.0
    Installed versions: 2.4.0.1
    Homepage: http://www.haskell.org/cabal/
    License:  BSD3

* HDBC
    Synopsis: Haskell Database Connectivity
    Default available version: 2.4.0.3
    Installed versions: 2.4.0.3
    Homepage: https://github.com/hdbc/hdbc
    License:  BSD3

* HDBC-odbc
    Synopsis: ODBC driver for HDBC
    Default available version: 2.6.0.0
    Installed versions: 2.6.0.0
    Homepage: https://github.com/hdbc/hdbc-odbc
    License:  BSD3

* Win32
    Synopsis: A binding to Windows Win32 API.
    Default available version: 2.8.3.0
    Installed versions: 2.6.1.0
    Homepage: https://github.com/haskell/win32
    License:  BSD3

* array
    Synopsis: Mutable and immutable arrays
    Default available version: 0.5.4.0
    Installed versions: 0.5.3.0
    License:  BSD3

* asn1-types
    Synopsis: ASN.1 types
    Default available version: 0.3.3
    Installed versions: 0.3.3
    Homepage: http://github.com/vincenthz/hs-asn1
    License:  BSD3

* async
    Synopsis: Run IO operations asynchronously and wait for their results
    Default available version: 2.2.2
    Installed versions: 2.2.2
    Homepage: https://github.com/simonmar/async
    License:  BSD3

* base
    Synopsis: Basic libraries
    Default available version: 4.12.0.0
    Installed versions: 4.12.0.0
    License:  BSD-3-Clause

* basement
    Synopsis: Foundation scrap box of array & string
    Default available version: 0.0.11
    Installed versions: 0.0.11
    Homepage: https://github.com/haskell-foundation/foundation#readme
    License:  BSD3

* binary
    Synopsis: Binary serialisation for Haskell values using lazy ByteStrings
    Default available version: 0.8.7.0
    Installed versions: 0.8.6.0
    Homepage: https://github.com/kolmodin/binary
    License:  BSD3

* byteable
    Synopsis: Type class for sequence of bytes
    Default available version: 0.1.1
    Installed versions: 0.1.1
    Homepage: http://github.com/vincenthz/hs-byteable
    License:  BSD3

* bytestring
    Synopsis: Fast, compact, strict and lazy byte strings with a list interface
    Default available version: 0.10.10.0
    Installed versions: 0.10.8.2
    Homepage: https://github.com/haskell/bytestring
    License:  BSD3

* cereal
    Synopsis: A binary serialization library
    Default available version: 0.5.8.1
    Installed versions: 0.5.8.1
    Homepage: https://github.com/GaloisInc/cereal
    License:  BSD3

* concurrent-extra
    Synopsis: Extra concurrency primitives
    Default available version: 0.7.0.12
    Installed versions: 0.7.0.12
    Homepage: https://github.com/basvandijk/concurrent-extra
    License:  BSD3

* containers
    Synopsis: Assorted concrete container types
    Default available version: 0.6.2.1
    Installed versions: 0.6.0.1
    License:  BSD3

* convertible
    Synopsis: Typeclasses and instances for converting between types
    Default available version: 1.1.1.0
    Installed versions: 1.1.0.0
    Homepage: http://hackage.haskell.org/package/convertible
    License:  BSD3

* cryptonite
    Synopsis: Cryptography Primitives sink
    Default available version: 0.26
    Installed versions: 0.26
    Homepage: https://github.com/haskell-crypto/cryptonite
    License:  BSD3

* data-default-class
    Synopsis: A class for types with a default value
    Default available version: 0.1.2.0
    Installed versions: 0.1.2.0
    License:  BSD3

* deepseq
    Synopsis: Deep evaluation of data structures
    Default available version: 1.4.4.0
    Installed versions: 1.4.4.0
    License:  BSD3

* directory
    Synopsis: Platform-agnostic library for filesystem operations
    Default available version: 1.3.4.0
    Installed versions: 1.3.3.0
    License:  BSD3

* filepath
    Synopsis: Library for manipulating FilePaths in a cross platform way.
    Default available version: 1.4.2.1
    Installed versions: 1.4.2.1
    Homepage: https://github.com/haskell/filepath#readme
    License:  BSD3

* ghc
    Synopsis: The GHC API
    Default available version: 8.6.5
    Installed versions: 8.6.5
    Homepage: http://www.haskell.org/ghc/
    License:  BSD3

* ghc-boot
    Synopsis: Shared functionality between GHC and its boot libraries
    Default available version: 8.8.1
    Installed versions: 8.6.5
    License:  BSD3

* ghc-boot-th
    Synopsis: Shared functionality between GHC and the `template-haskell`
              library
    Default available version: 8.8.1
    Installed versions: 8.6.5
    License:  BSD3

* ghc-compact
    Synopsis: In memory storage of deeply evaluated data structure
    Default available version: 0.1.0.0
    Installed versions: 0.1.0.0
    License:  BSD3

* ghc-heap
    Default available version: [ Not available from any configured repository ]
    Installed versions: 8.6.5
    License:  BSD-3-Clause

* ghc-prim
    Synopsis: GHC primitives
    Default available version: 0.5.3
    Installed versions: 0.5.3
    License:  BSD-3-Clause

* ghci
    Synopsis: The library supporting GHC's interactive interpreter
    Default available version: 8.6.5
    Installed versions: 8.6.5
    License:  BSD3

* hashable
    Synopsis: A class for types that can be converted to a hash value
    Default available version: 1.3.0.0
    Installed versions: 1.3.0.0
    Homepage: http://github.com/tibbe/hashable
    License:  BSD3

* haskeline
    Synopsis: A command-line interface for user input, written in Haskell.
    Default available version: 0.7.5.0
    Installed versions: 0.7.4.3
    Homepage: https://github.com/judah/haskeline
    License:  BSD3

* hostname
    Synopsis: A very simple package providing a cross-platform means of
              determining the hostname
    Default available version: 1.0
    Installed versions: 1.0
    License:  BSD3

* hourglass
    Synopsis: simple performant time related library
    Default available version: 0.2.12
    Installed versions: 0.2.12
    Homepage: https://github.com/vincenthz/hs-hourglass
    License:  BSD3

* hpc
    Synopsis: Code Coverage Library for Haskell
    Default available version: 0.6.0.3
    Installed versions: 0.6.0.3
    License:  BSD3

* hscolour
    Synopsis: Colourise Haskell code.
    Default available version: 1.24.4
    Installed versions: 1.24.4
    Homepage: http://code.haskell.org/~malcolm/hscolour/
    License:  LGPL

* integer-gmp
    Synopsis: Integer library based on GMP
    Default available version: 1.0.2.0
    Installed versions: 1.0.2.0
    License:  BSD3

* libiserv
    Default available version: [ Not available from any configured repository ]
    Installed versions: 8.6.3
    License:  BSD-3-Clause

* memory
    Synopsis: memory and related abstraction stuff
    Default available version: 0.15.0
    Installed versions: 0.15.0
    Homepage: https://github.com/vincenthz/hs-memory
    License:  BSD3

* mtl
    Synopsis: Monad classes, using functional dependencies
    Default available version: 2.2.2
    Installed versions: 2.2.2
    Homepage: http://github.com/haskell/mtl
    License:  BSD3

* old-locale
    Synopsis: locale library
    Default available version: 1.0.0.7
    Installed versions: 1.0.0.7
    License:  BSD3

* old-time
    Synopsis: Time library
    Default available version: 1.1.0.3
    Installed versions: 1.1.0.3
    License:  BSD3

* parsec
    Synopsis: Monadic parser combinators
    Default available version: 3.1.14.0
    Installed versions: 3.1.13.0
    Homepage: https://github.com/haskell/parsec
    License:  BSD3

* pem
    Synopsis: Privacy Enhanced Mail (PEM) format reader and writer.
    Default available version: 0.2.4
    Installed versions: 0.2.4
    Homepage: http://github.com/vincenthz/hs-pem
    License:  BSD3

* pretty
    Synopsis: Pretty-printing library
    Default available version: 1.1.3.6
    Installed versions: 1.1.3.6
    Homepage: http://github.com/haskell/pretty
    License:  BSD3

* primitive
    Synopsis: Primitive memory-related operations
    Default available version: 0.7.0.0
    Installed versions: 0.7.0.0
    Homepage: https://github.com/haskell/primitive
    License:  BSD-3-Clause

* process
    Synopsis: Process libraries
    Default available version: 1.6.6.0
    Installed versions: 1.6.5.0
    License:  BSD3

* random
    Synopsis: random number library
    Default available version: 1.1
    Installed versions: 1.1
    License:  BSD3

* rts
    Default available version: [ Not available from any configured repository ]
    Installed versions: 1.0
    License:  BSD-3-Clause

* securemem
    Synopsis: abstraction to an auto scrubbing and const time eq, memory chunk.
    Default available version: 0.1.10
    Installed versions: 0.1.10
    Homepage: https://github.com/vincenthz/hs-securemem
    License:  BSD3

* stm
    Synopsis: Software Transactional Memory
    Default available version: 2.5.0.0
    Installed versions: 2.5.0.0
    Homepage: https://wiki.haskell.org/Software_transactional_memory
    License:  BSD3

* template-haskell
    Synopsis: Support library for Template Haskell
    Default available version: 2.15.0.0
    Installed versions: 2.14.0.0
    License:  BSD3

* text
    Synopsis: An efficient packed Unicode text type.
    Default available version: 1.2.4.0
    Installed versions: 1.2.3.1
    Homepage: https://github.com/haskell/text
    License:  BSD2

* time
    Synopsis: A time library
    Default available version: 1.9.3
    Installed versions: 1.8.0.2
    Homepage: https://github.com/haskell/time
    License:  BSD3

* transformers
    Synopsis: Concrete functor and monad transformers
    Default available version: 0.5.6.2
    Installed versions: 0.5.6.2
    License:  BSD3

* unbounded-delays
    Synopsis: Unbounded thread delays and timeouts
    Default available version: 0.1.1.0
    Installed versions: 0.1.1.0
    Homepage: https://github.com/basvandijk/unbounded-delays
    License:  BSD3

* utf8-string
    Synopsis: Support for reading and writing UTF8 Strings
    Default available version: 1.0.1.1
    Installed versions: 1.0.1.1
    Homepage: http://github.com/glguy/utf8-string/
    License:  BSD3

* uuid-types
    Synopsis: Type definitions for Universally Unique Identifiers
    Default available version: 1.0.3
    Installed versions: 1.0.3
    Homepage: https://github.com/aslatter/uuid
    License:  BSD3

* vector
    Synopsis: Efficient Arrays
    Default available version: 0.12.0.3
    Installed versions: 0.12.0.3
    Homepage: https://github.com/haskell/vector
    License:  BSD3

* xhtml
    Synopsis: An XHTML combinator library
    Default available version: 3000.2.2.1
    Installed versions: 3000.2.2.1
    Homepage: https://github.com/haskell/xhtml
    License:  BSD3

项目的.cabal库和可执行文件如下

library
  exposed-modules:    HDBC,
                      HDBC-odbc
  -- other-modules:
  -- other-extensions:
  build-depends:       base >=4.12 && <4.13
  hs-source-dirs:      src
  default-language:    Haskell2010

executable collatz
  main-is:             Main.hs
  -- other-modules:
  -- other-extensions:
  build-depends:       base >=4.12 && <4.13
  hs-source-dirs:      src
  default-language:    Haskell2010

但是在项目中仍然无法识别模块。

module Main where

import Database.HDBC
import Database.HDBC.ODBC

main :: IO ()
main = do
Could not find module `Database.HDBC'
Could not find module `Database.HDBC.ODBC'

我将模块放在单独的目录中,但是我尝试将它们直接放入同一目录中也没有成功,因此我不确定是否有必要。.

我还很陌生,这是我第一次处理这样的导入模块。我进行了大量的搜索,但没有找到成功的指南,也没有发现与我类似的问题。

如果出于某种原因有帮助,我正在Windows 10的VSCode上使用Haskero。

0 个答案:

没有答案