Я пытался изменить проект, чтобы он также предоставил библиотеку (ранее это был просто исполняемый файл).
Единственное изменение было (в пакете hpack package.yaml):
+library:
+ source-dirs: src
+ exposed-modules:
+ - CYAva
Однако теперь при запуске stack build
я вижу вывод:
2018-12-31 16:32:06.406901: [warn] Failed to load interface for `Main'
2018-12-31 16:32:06.407023: [warn] no unit id matching `main' was found
файл пакета:
library:
source-dirs: src
exposed-modules:
- CYAva
executable:
source-dirs: src
main: Main.hs
license-file: LICENSE
build-type: Simple
maintainer: Chris Stryczynski
dependencies:
- base >=4.10 && <4.12
- colour
- data-default-class
# common
- Chart-cairo
- Chart
- lens
- aeson
- bytestring
- stm
- split
- text
- time
- thyme
- binary
- binary-orphans
- old-locale
- directory
- pretty-simple
- string-conversions
- optparse-applicative
name: ceriumyankeeavocado
version: '0.1.0.0'
extra-source-files: ChangeLog.md
author: Chris Stryczynski
license: BSD3
файл кабала:
cabal-version: 1.12
-- This file has been generated from package.yaml by hpack version 0.31.1.
--
-- see: https://github.com/sol/hpack
--
-- hash: d90f1b53fc8bb74ddff9cf98937222e0c38a20affcd2506880039312e549541f
name: ceriumyankeeavocado
version: 0.1.0.0
author: Chris Stryczynski
maintainer: Chris Stryczynski
license: BSD3
license-file: LICENSE
build-type: Simple
extra-source-files:
ChangeLog.md
library
exposed-modules:
CYAva
other-modules:
Main
Paths_ceriumyankeeavocado
hs-source-dirs:
src
build-depends:
Chart
, Chart-cairo
, aeson
, base >=4.10 && <4.12
, binary
, binary-orphans
, bytestring
, colour
, data-default-class
, directory
, lens
, old-locale
, optparse-applicative
, pretty-simple
, split
, stm
, string-conversions
, text
, thyme
, time
default-language: Haskell2010
executable ceriumyankeeavocado
main-is: Main.hs
other-modules:
CYAva
Paths_ceriumyankeeavocado
hs-source-dirs:
src
build-depends:
Chart
, Chart-cairo
, aeson
, base >=4.10 && <4.12
, binary
, binary-orphans
, bytestring
, colour
, data-default-class
, directory
, lens
, old-locale
, optparse-applicative
, pretty-simple
, split
, stm
, string-conversions
, text
, thyme
, time
default-language: Haskell2010
stack build
thyme-0.3.5.5: configure
thyme-0.3.5.5: build
Chart-1.9: configure
Chart-1.9: build
Chart-1.9: copy/register
Chart-cairo-1.9: configure
Chart-cairo-1.9: build
Chart-cairo-1.9: copy/register
thyme-0.3.5.5: copy/register
Building all executables for `ceriumyankeeavocado' once. After a successful build of all of them, only specified executables will be rebuilt.
ceriumyankeeavocado-0.1.0.0: configure (lib + exe)
Configuring ceriumyankeeavocado-0.1.0.0...
ceriumyankeeavocado-0.1.0.0: build (lib + exe)
Preprocessing executable 'ceriumyankeeavocado' for ceriumyankeeavocado-0.1.0.0..
Building executable 'ceriumyankeeavocado' for ceriumyankeeavocado-0.1.0.0..
[1 of 3] Compiling CYAva ( src/CYAva.hs, .stack-work/dist/x86_64-linux-nix/Cabal-2.2.0.1/build/ceriumyankeeavocado/ceriumyankeeavocado-tmp/CYAva.o )
[2 of 3] Compiling Main ( src/Main.hs, .stack-work/dist/x86_64-linux-nix/Cabal-2.2.0.1/build/ceriumyankeeavocado/ceriumyankeeavocado-tmp/Main.o )
[3 of 3] Compiling Paths_ceriumyankeeavocado ( .stack-work/dist/x86_64-linux-nix/Cabal-2.2.0.1/build/ceriumyankeeavocado/autogen/Paths_ceriumyankeeavocado.hs, .stack-work/dist/x86_64-linux-nix/Cabal-2.2.0.1/build/ceriumyankeeavocado/ceriumyankeeavocado-tmp/Paths_ceriumyankeeavocado.o )
Linking .stack-work/dist/x86_64-linux-nix/Cabal-2.2.0.1/build/ceriumyankeeavocado/ceriumyankeeavocado ...
Preprocessing library for ceriumyankeeavocado-0.1.0.0..
Building library for ceriumyankeeavocado-0.1.0.0..
[1 of 3] Compiling CYAva ( src/CYAva.hs, .stack-work/dist/x86_64-linux-nix/Cabal-2.2.0.1/build/CYAva.o )
[2 of 3] Compiling Main ( src/Main.hs, .stack-work/dist/x86_64-linux-nix/Cabal-2.2.0.1/build/Main.o )
Failed to load interface for `Main'
no unit id matching `main' was found
Completed 4 action(s).
-- While building package ceriumyankeeavocado-0.1.0.0 using:
/home/chris/.stack/setup-exe-cache/x86_64-linux-nix/Cabal-simple_mPHDZzAJ_2.2.0.1_ghc-8.4.3 --builddir=.stack-work/dist/x86_64-linux-nix/Cabal-2.2.0.1 build lib:ceriumyankeeavocado exe:ceriumyankeeavocado --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"