Skip to content

cabal build succeeds but SublimeHaskell build fails #158

Closed

Description

@radustoenescu

A project uses certain language extensions, the definition of that component in the .cabal file is:

library

default-language:   Haskell2010

build-depends:      base < 5 && >= 4
                ,   containers
                ,   array
                ,   text
default-extensions: MultiParamTypeClasses
                ,   TypeSynonymInstances
                ,   FlexibleInstances
                ,   OverlappingInstances

ghc-options:        -Wall
                    -fno-warn-unused-imports
                    -fno-warn-unused-binds
                    -fno-warn-unused-do-bind
                    -fno-warn-type-defaults

hs-source-dirs:     src

exposed-modules:    Applications

Issuing cabal build works of from command line, but the build system used by SublimeHaskell fails with:

Behaviours.hs: line 4, column 1:
Too many parameters for class `ToContainer'
(Use -XMultiParamTypeClasses to allow multi-parameter classes)
In the class declaration for `ToContainer'

If I use "auto_build_mode": "normal" instead of "normal_then_warnings" everything works fine.

How can I fix this ?

Activity

  1. nh2 commented on Jul 29, 2014

    @nh2
    Member

    Hi, can you check that your Sublime is actually building with cabal and not ghc-mod? If you are using ghc-mod, it might ignore your cabal file.

  2. radustoenescu commented on Jul 30, 2014

    @radustoenescu
    Author

    Hello, this is output grabbed from Sublime's console.
    Sublime Haskell: running build commands: [['cabal', 'build']]
    Is this what you were looking for ?

  3. nh2 commented on Jul 30, 2014

    @nh2
    Member

    Yes. Can you check what cabal build --ghc-options="-fforce-recomp -Wall -fno-code" in the command line says?

  4. radustoenescu commented on Jul 31, 2014

    @radustoenescu
    Author

    I did this:
    cabal clean && cabal configure && "your above mentioned command"
    and the build succeeds, there are plenty of warnings but no errors.

  5. nh2 commented on Jul 31, 2014

    @nh2
    Member

    Hmm, this is basically what SublimeHaskell calls; can you check that your command line uses the same cabal and GHC versions/binaries that SublimeHaskell uses (e.g. as set in the add_to_PATH setting)?

  6. chamini2 commented on Oct 2, 2014

    @chamini2

    I have some problems too with a project I'm developing in a cabal-sandbox, the .cabal has this:

    name:                sapphire
    version:             0.1.0.0
    synopsis:            Sapphire programming language compiler
    license:             BSD3
    license-file:        LICENSE
    author:              -- authors
    maintainer:          -- email
    
    category:            Language
    build-type:          Simple
    cabal-version:       >=1.10
    
    executable sapphire
      main-is:             Sapphire.hs
    
      other-modules:       Lexer, Parser
    
      other-extensions:    TupleSections
                         , FlexibleContexts
                         , FlexibleInstances
                         , GeneralizedNewtypeDeriving
                         , NamedFieldPuns
                         , TypeSynonymInstances
    
      build-depends:       base >=4.7 && <4.8
                         , containers >=0.5 && <0.6
                         , transformers >=0.3 && <0.4
                         , mtl >=2.1.3.1 && < 2.2
                         , array >=0.5 && <0.6
                         , split >=0.2.2 && <0.2.3
    
      build-tools:         alex, happy
      default-language:    Haskell2010
    

    But when hitting ⌘S SublimeHaskell reports:

    Build FAILED
    
    REMAINING STDERR:
    
    cabal: The program 'ghc' version >=6.4 is required but it could not be found.
    Warning: Couldn't reinstall some add-source dependencies.
    cabal: The program 'ghc' version >=6.4 is required but it could not be found.
    

    My add_to_PATH has ["./.cabal-sandbox/bin/", "/Users/<user>/.cabal/bin"].

  7. nh2 commented on Oct 3, 2014

    @nh2
    Member

    @chamini2 Do you have GHC in your system path? Otherwise, try adding the directory that contains ghcto add_to_PATH as well.

  8. chamini2 commented on Oct 3, 2014

    @chamini2

    Well, that did it. Thank you! It was in /usr/local/bin/ghc because I installed it with brew install ghc.

  9. nh2 commented on Oct 3, 2014

    @nh2
    Member

    Closing until this doesn't work for somebody.

  10. crockeea commented on Nov 13, 2014

    @crockeea

    I'm having the same problem as @radustoenescu ("normal" mode works, but "normal-then-warnings" fails with ghc: no input files). Unlike radustoenescu however, when I tried

    cabal clean
    cabal configure
    cabal build --ghc-options="-fforce-recomp -Wall -fno-code"

    at the console, I get the same error: ghc: no input files. Is this somehow related to this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions