diagrams / diagrams-contrib

User-contributed extensions to diagrams
BSD 3-Clause "New" or "Revised" License
27 stars 31 forks source link

Can not build with stack #76

Closed jdevoto closed 6 years ago

jdevoto commented 6 years ago

Hello.

I have a small project. I tried to build it with stack and I get the following error

[15 of 28] Compiling Diagrams.TwoD.Path.Follow ( src/Diagrams/TwoD/Path/Follow.hs, .stack-work/dist/x86_64-linux/Cabal-2.0.1.0/build/Diagrams/TwoD/Path/Follow.o )

    /tmp/stack30251/diagrams-contrib-1.4.3/src/Diagrams/TwoD/Path/Follow.hs:64:21: error:
        • No instance for (Semigroup (Semi (Trail' Line V2 n) (Angle n)))
            arising from the 'deriving' clause of a data type declaration
          Possible fix:
            use a standalone 'deriving instance' declaration,
              so you can specify the instance context yourself
        • When deriving the instance for (Semigroup (Following n))
       |
    64 |   deriving (Monoid, Semigroup)

Here is the stack.yaml

# This file was automatically generated by 'stack init'
#
# Some commonly used options have been documented as comments in this file.
# For advanced use and comprehensive documentation of the format, please see:
# https://docs.haskellstack.org/en/stable/yaml_configuration/

# Resolver to choose a 'specific' stackage snapshot or a compiler version.
# A snapshot resolver dictates the compiler version and the set of packages
# to be used for project dependencies. For example:
#
# resolver: lts-3.5
# resolver: nightly-2015-09-21
# resolver: ghc-7.10.2
# resolver: ghcjs-0.1.0_ghc-7.10.2
# resolver:
#  name: custom-snapshot
#  location: "./custom-snapshot.yaml"
# resolver: lts-11.12
resolver: lts-10.10  # changed from the up

# User packages to be built.
# Various formats can be used as shown in the example below.
#
# packages:
# - some-directory
# - https://example.com/foo/bar/baz-0.0.2.tar.gz
# - location:
#    git: https://github.com/commercialhaskell/stack.git
#    commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a
# - location: https://github.com/commercialhaskell/stack/commit/e7b331f14bcffb8367cd58fbfc8b40ec7642100a
#   extra-dep: true
#  subdirs:
#  - auto-update
#  - wai
#
# A package marked 'extra-dep: true' will only be built if demanded by a
# non-dependency (i.e. a user package), and its test suites and benchmarks
# will not be run. This is useful for tweaking upstream packages.
packages:
- .

# Dependency packages to be pulled from upstream that are not in the resolver
# (e.g., acme-missiles-0.3)
extra-deps:

- diagrams-1.4
- diagrams-core-1.4.1
- diagrams-lib-1.4.2.2
- diagrams-solve-0.1.1
- dual-tree-0.2.2
- diagrams-contrib-1.4.3
- diagrams-svg-1.4.2
- cubicbezier-0.6.0.5
- mfsolve-0.3.2.0
- fast-math-1.0.2
- newtype-generics-0.5.3

# Override default flag values for local packages and extra-deps
# flags: {}

# Extra package databases containing global packages
# extra-package-dbs: []

# Control whether we use the GHC we find on the path
# system-ghc: true
#
# Require a specific version of stack, using version ranges
# require-stack-version: -any # Default
# require-stack-version: ">=1.6"
#
# Override the architecture used by stack, especially useful on Windows
# arch: i386
# arch: x86_64
#
# Extra directories used by stack for building
# extra-include-dirs: [/path/to/dir]
# extra-lib-dirs: [/path/to/dir]
#
# Allow a newer minor version of GHC than the snapshot specifies
# compiler-check: newer-minor

and here is the package.yaml
name:                heathsim
version:             0.1.0.0
github:              "jdevoto/heathsim"
license:             BSD3
author:              "Jorge A. Devoto"
maintainer:          "jorge.a.devoto@gmail.com"
copyright:           "GNU"

extra-source-files:
- README.md
- ChangeLog.md

# Metadata used when publishing your package
# synopsis:            Short description of your package
# category:            programing

# To avoid duplicated efforts in documentation and dealing with the
# complications of embedding Haddock markup inside cabal files, it is
# common to point users to the README.md file.
description:         Please see the README on GitHub at <https://github.com/jdevoto/heathsim#readme>

dependencies:
- base >= 4.7 && < 5
- diagrams # added

library:
  source-dirs: src

executables:
  heathsim-exe:
    main:                Main.hs
    source-dirs:         app
    ghc-options:
    - -threaded
    - -rtsopts
    - -with-rtsopts=-N
    dependencies:
    - heathsim

tests:
  heathsim-test:
    main:                Spec.hs
    source-dirs:         test
    ghc-options:
    - -threaded
    - -rtsopts
    - -with-rtsopts=-N
    dependencies:
    - heathsim

Thanks for any help

byorgey commented 6 years ago

What happens if you change to diagrams-lib-1.4.2.3 in your extra-deps?

jdevoto commented 6 years ago

I get this message:

/tmp/stack4346/diagrams-contrib-1.4.3/src/Diagrams/TwoD/Path/Follow.hs:64:21: error: • No instance for (Semigroup (Semi (Trail' Line V2 n) (Angle n))) arising from the 'deriving' clause of a data type declaration Possible fix: use a standalone 'deriving instance' declaration, so you can specify the instance context yourself • When deriving the instance for (Semigroup (Following n)) | 64 | deriving (Monoid, Semigroup)

jdevoto commented 6 years ago

I have the same problem. There is no porblem if I use resolver: lts-11.12 in stack.yaml. But if I do this, then I get

/home/jdevoto/Haskell/Projects/heathsim/src/Lib.hs:9:1: error: Could not find module ‘Diagrams.Prelude’ Use -v to see a list of the files searched for. | 9 | import Diagrams.Prelude | ^^^^^^^^^^^^^^^^^^^^^^^

/home/jdevoto/Haskell/Projects/heathsim/src/Lib.hs:10:1: error: Could not find module ‘Diagrams.Backend.Cairo.CmdLine’ Use -v to see a list of the files searched for. | 10 | import Diagrams.Backend.Cairo.CmdLine | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Completed 5 action(s).

Thanks in advance for any help

Jorge

On 13 June 2018 at 15:46, Brent Yorgey notifications@github.com wrote:

What happens if you change to diagrams-lib-1.4.2.3 in your extra-deps?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/diagrams/diagrams-contrib/issues/76#issuecomment-397045094, or mute the thread https://github.com/notifications/unsubscribe-auth/AASoUtgovjSVr29D3CpaoYGNnydWy2-tks5t8V4LgaJpZM4UmpR0 .

byorgey commented 6 years ago

@jdevoto Sorry for the delay in responding. What packages do you have listed in the build-depends field in your .cabal file? You need to list diagrams-lib and diagrams-cairo if you want to use those modules.

jdevoto commented 6 years ago

I did what you suggested putting diagrams-lib and diagrams-cairo in the package.yaml and it worked.

Thanks for your help!!!

Jorge

On Wed, 27 Jun 2018 at 09:06, Brent Yorgey notifications@github.com wrote:

@jdevoto https://github.com/jdevoto Sorry for the delay in responding. What packages do you have listed in the build-depends field in your .cabal file? You need to list diagrams-lib and diagrams-cairo if you want to use those modules.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/diagrams/diagrams-contrib/issues/76#issuecomment-400648395, or mute the thread https://github.com/notifications/unsubscribe-auth/AASoUiUcWUsIhXyl6_3IJA4_lRmIuofMks5uA3VEgaJpZM4UmpR0 .

byorgey commented 6 years ago

Great, glad it worked!