DanielG / ghc-mod

Happy Haskell Hacking for editors. DEPRECATED
Other
678 stars 175 forks source link

Compiler #if directive leads to lexical error message. #460

Closed geraldus closed 9 years ago

geraldus commented 9 years ago

I have Yesod project, when I try to check it with ghc-mod it fails because of there is #if-#else directives in Settings/Development.hs file:

development :: Bool
development =
#if DEVELOPMENT
  True
#else
  False
#endif

The error message I have is:

$ ghc-mod check Application.hs

Warning:: Could not find a componenet assignment, falling back to sandbox only project options. Settings/Development.hs:7:2:lexical error at character 'i'

Note: I'm using upcoming ghc-mod version from Daniel's repository, because I'm using cabal-1.22, so I can't be certain does this issue occurs with ghc-mod form master branch of original repository.

This also have impact on Emacs' ghc-mod support:

Debugger entered--Lisp error: (wrong-type-argument listp Warning::)
  ghc-to-info(Warning::)
  ghc-check-callback(ok)
  ghc-process-filter(#<process /Users/arthurfayzrakhmanov/Haskell/YesodProject> "(\"Settings/Development.hs:7:2:lexical error at character 'i'\")\nOK\n")
geraldus commented 9 years ago

I'm not sure what happened, but now I can't reproduce this behaviour (though I was able to in past, and checked it several times before open issue).

DanielG commented 9 years ago

You need {-# LANGUAGE CPP #-} unless you enable CPP in your cabal file? In any case check ghc-mod debug it should list -XCPP if it's configured right.

DanielG commented 9 years ago

Also my fork is completely untested with the emacs frontend. I got told the newly introduced logging to stderr confuses emacs so you might want to replace ghc-mod(i) with a script that redirects stderr to /dev/null or make gmLog in the source code a nop.

geraldus commented 9 years ago

Sorry for such unclear report, strange magic happening around here. CPP extension is listed in cabal file (this is Yesod scaffolded web site). ghc-mod debug shows -XCPP too.

Yesterday I was able to make checking of this project though, but don't know how! All I've noticed that there was another warning, but check was successful (I've tested various project files after that, running ghc-mod from project root):

info loadTargets: Switching to LinkInMemory/HscInterpreted (memory hungry)

But today I still have issue with directives.

I also have -fobject-code option enabled in my .ghci file (if it matters).

Regarding Emacs: I didn't understand solutions you suggested, but don't bother yourself (dunno how to redirect output, and how to replace ghc-mod, and don't know what «nop» means).

geraldus commented 9 years ago

Here is another little observation: it is still successfully checks some files, for example Foundation.hs, Model.hs:

$ ghc-mod check Foundation.hs
info: loadTargets: Switching to LinkInMemory/HscInterpreted (memory hungry)
Internal/Persist.hs:7:1:Warning: Orphan instance:  instance persistent-2.1.2:Database.Persist.Sql.Class.PersistFieldSql             Answer
Internal/Persist.hs:7:1:Warning: Orphan instance:  instance persistent-2.1.2:Database.Persist.Class.PersistField.PersistField             Answer

When checking other files I see mentioned error. I tried to run ghc-mod both from project root and from inner project folders.

DanielG commented 9 years ago

Can you post the whole output of ghc-mod debug?

So the significant hint in the output is the Could not find a componenet assignment, falling back to sandbox only project options. that means that ghc-mod was unable to figure out which cabal component that file belongs to, hence it has no idea which component's options to apply when bringing up ghc. Sandbox only options consist only of source paths i.e. -i and -package-db for the sandbox package-db. Notably all the language flags are missing hence the lexical error.

I think erroring out when no component assignment can be found might be better but IIRC there was some case that breaks completely if I do that.

geraldus commented 9 years ago

Sorry for such long delay, I'm out of my usual location now, and have limited internet access. Here is the full log (sorry, have to hide some real names, I hope this will not affect overall report):

$ ghc-mod debug
Root directory:       /Users/arthurfayzrakhmanov/Haskell/XXXXXYYYY
Current directory:    /Users/arthurfayzrakhmanov/Haskell/XXXXXYYYY
GHC System libraries: /Applications/ghc-7.8.4.app/Contents/lib/ghc-7.8.4
GHC user options:
Cabal file:           Just "/Users/arthurfayzrakhmanov/Haskell/XXXXXYYYY/XXXXXYYYY.cabal"
Cabal entrypoints:
    Setup.hs
    library
        Model (Model.hs)
        Application (Application.hs)
        Foundation (Foundation.hs)
        Import (Import.hs)
        Import.NoFoundation (Import/NoFoundation.hs)
        Internal.CssHelpers (Internal/CssHelpers.hs)
        Internal.Persist (Internal/Persist.hs)
        Settings (Settings.hs)
        Settings.StaticFiles (Settings/StaticFiles.hs)
        Settings.Development (Settings/Development.hs)
        Handler.Home (Handler/Home.hs)
        Handler.YYYY (Handler/YYYY.hs)
        Handler.SignupLoc (Handler/SignupLoc.hs)
        Handler.VerifyLoc (Handler/VerifyLoc.hs)
        Handler.PasswordResetLoc (Handler/PasswordResetLoc.hs)
        Handler.ZZZZZZZLoc (Handler/ZZZZZZZLoc.hs)
        Handler.ZZZZZZZDetails (Handler/ZZZZZZZDetails.hs)
        Handler.ZZZZZZZ.TableView (Handler/ZZZZZZZ/TableView.hs)
        Handler.Api.ZZZZZZZ.Success (Handler/Api/ZZZZZZZ/Success.hs)
        Handler.AccountSock (Handler/AccountSock.hs)
        Handler.YYYYSock (Handler/YYYYSock.hs)
        Handler.NotifySock (Handler/NotifySock.hs)
        Handler.SetLang (Handler/SetLang.hs)
        Handler.Form.Import (Handler/Form/Import.hs)
        Handler.Form.LogIn (Handler/Form/LogIn.hs)
        Handler.Form.ResendVerMail (Handler/Form/ResendVerMail.hs)
        Handler.Form.SignUp (Handler/Form/SignUp.hs)
        Handler.Form.SignedEmail (Handler/Form/SignedEmail.hs)
        Handler.WWWWWWR (Handler/WWWWWWR.hs)
        Custom.SvgIcons (Custom/SvgIcons.hs)
    exe:XXXXXYYYY
        Main (app/main.hs)
Cabal components:
    Setup.hs
    library
        Model
            Internal.Persist
        Application
            Import
            Settings
            Handler.Home
            Handler.YYYY
            Handler.SignupLoc
            Handler.VerifyLoc
            Handler.PasswordResetLoc
            Handler.ZZZZZZZLoc
            Handler.ZZZZZZZDetails
            Handler.Api.ZZZZZZZ.Success
            Handler.AccountSock
            Handler.YYYYSock
            Handler.NotifySock
            Handler.SetLang
            Handler.WWWWWWR
            Internal.Auth
        Foundation
            Model
            Internal.CssHelpers
            Settings
            Settings.StaticFiles
            Settings.Development
        Import
            Foundation
            Import.NoFoundation
        Import.NoFoundation
            Model
            Internal.CssHelpers
            Settings
            Settings.StaticFiles
            Settings.Development
            Handler.Form.Import
        Internal.CssHelpers
        Internal.Persist
        Settings
            Settings.Development
        Settings.StaticFiles
            Settings
            Settings.Development
        Settings.Development
        Handler.Home
            Import
            Handler.Form.LogIn
        Handler.YYYY
            Import
            Custom.SvgIcons
        Handler.SignupLoc
            Import
            Handler.Form.SignUp
        Handler.VerifyLoc
            Import
            Handler.Form.ResendVerMail
        Handler.PasswordResetLoc
            Import
            Handler.Form.SignedEmail
        Handler.ZZZZZZZLoc
            Import
            Handler.ZZZZZZZ.TableView
        Handler.ZZZZZZZDetails
            Import
            Handler.ZZZZZZZ.TableView
        Handler.ZZZZZZZ.TableView
            Import
        Handler.Api.ZZZZZZZ.Success
            Import
            Handler.ZZZZZZZDetails
            Handler.ZZZZZZZ.TableView
        Handler.AccountSock
            Import
        Handler.YYYYSock
            Import
        Handler.NotifySock
            Import
        Handler.SetLang
            Import
        Handler.Form.Import
        Handler.Form.LogIn
            Import
            Internal.Auth
        Handler.Form.ResendVerMail
            Import
            Handler.Form.SignedEmail
            Internal.Auth
        Handler.Form.SignUp
            Import
            Internal.Auth
        Handler.Form.SignedEmail
            Import
            Internal.Auth
        Handler.WWWWWWR
            Import
        Custom.SvgIcons
            Import
        Internal.Auth
    exe:XXXXXYYYY
        Model
            Internal.Persist
        Application
            Import
            Settings
            Handler.Home
            Handler.YYYY
            Handler.SignupLoc
            Handler.VerifyLoc
            Handler.PasswordResetLoc
            Handler.ZZZZZZZLoc
            Handler.ZZZZZZZDetails
            Handler.Api.ZZZZZZZ.Success
            Handler.AccountSock
            Handler.YYYYSock
            Handler.NotifySock
            Handler.SetLang
            Handler.WWWWWWR
            Internal.Auth
        Foundation
            Model
            Internal.CssHelpers
            Settings
            Settings.StaticFiles
            Settings.Development
        Import
            Foundation
            Import.NoFoundation
        Import.NoFoundation
            Model
            Internal.CssHelpers
            Settings
            Settings.StaticFiles
            Settings.Development
            Handler.Form.Import
        Internal.CssHelpers
        Internal.Persist
        Settings
            Settings.Development
        Settings.StaticFiles
            Settings
            Settings.Development
        Settings.Development
        Handler.Home
            Import
            Handler.Form.LogIn
        Handler.YYYY
            Import
            Custom.SvgIcons
        Handler.SignupLoc
            Import
            Handler.Form.SignUp
        Handler.VerifyLoc
            Import
            Handler.Form.ResendVerMail
        Handler.PasswordResetLoc
            Import
            Handler.Form.SignedEmail
        Handler.ZZZZZZZLoc
            Import
            Handler.ZZZZZZZ.TableView
        Handler.ZZZZZZZDetails
            Import
            Handler.ZZZZZZZ.TableView
        Handler.ZZZZZZZ.TableView
            Import
        Handler.Api.ZZZZZZZ.Success
            Import
            Handler.ZZZZZZZDetails
            Handler.ZZZZZZZ.TableView
        Handler.AccountSock
            Import
        Handler.YYYYSock
            Import
        Handler.NotifySock
            Import
        Handler.SetLang
            Import
        Handler.Form.Import
        Handler.Form.LogIn
            Import
            Internal.Auth
        Handler.Form.ResendVerMail
            Import
            Handler.Form.SignedEmail
            Internal.Auth
        Handler.Form.SignUp
            Import
            Internal.Auth
        Handler.Form.SignedEmail
            Import
            Internal.Auth
        Handler.WWWWWWR
            Import
        Custom.SvgIcons
            Import
        Main
            Application
            Settings
        Internal.Auth
GHC Cabal options:
    Setup.hs
    library
        -w -v0 -fbuilding-cabal-package -O -outputdir dist/build -odir
        dist/build -hidir dist/build -stubdir dist/build -i -idist/build
        -i. -idist/build/autogen -Idist/build/autogen -Idist/build
        -optP-include -optPdist/build/autogen/cabal_macros.h
        -hide-all-packages -no-user-package-db -package-db
        /code/XXXXXYYYY/.cabal-sandbox/x86_64-linux-ghc-7.8.4-packages.conf.d
        -package-id SHA-1.6.4.2-f5b7199ffce4ee302c5d6b679ebe4110
        -package-id XXXXXYYYYLib-0.7.0.10-9336c1d51310d7e40b51dc13cca4c45e
        -package-id aeson-0.8.0.2-183470d27877951223975dbc4efd065f
        -package-id base-4.7.0.2-bfd89587617e381ae01b8dd7b6c7f1c1
        -package-id blaze-html-0.8.0.2-8d75490f5be56eb5a097afb3dd462e1d
        -package-id blaze-markup-0.7.0.2-f401f5962df2bce73b225a204c966d77
        -package-id bytestring-0.10.4.0-d6f1d17d717e8652498cab8269a0acd5
        -package-id conduit-1.2.4-49831f3e5967857a3b25bd2c9ae19eea
        -package-id data-default-0.5.3-080d154f8a51830037b99cc610c6c441
        -package-id data-easy-0.5-592b59d0116bdeda44ff35cb0606086e
        -package-id directory-1.2.1.0-07cd1f59e3c6cac5e3e180019c59a115
        -package-id esqueleto-2.1.2.2-81a7568699d4ec6f80ac2d9c3ab98819
        -package-id fast-logger-2.3.1-c6564998ff9dbd56576dc8ff3ef02140
        -package-id hjsmin-0.1.4.7-99d6cc3104d73a123ecd6f7c1cd6649b
        -package-id http-conduit-2.1.5-bda467660926707461cd01a7f1044a4e
        -package-id markdown-0.1.13.1-0b76712dca68e9ba56567d128fd6f030
        -package-id mime-mail-0.4.8.2-34cd2a2ea86c48a8dc92f6b51dc898c8
        -package-id monad-control-1.0.0.4-6c1f8e5fbca10f10e897dd10e058dbee
        -package-id monad-logger-0.3.13.1-8f4a61421869cdf5cc1e70e2cb6d8991
        -package-id persistent-2.1.2-944c7318a38bb472c849283b87ebe086
        -package-id persistent-mysql-2.1.3-68a28fcd63c00b69483b682babe8472f
        -package-id
        persistent-template-2.1.1-de312de889a88a09f87307ebf2156887
        -package-id random-1.1-092becd083af689459dfd417368314bf -package-id
        safe-0.3.8-2768015ac3c05191f36e05e355f041d5 -package-id
        shakespeare-2.0.4.1-02a5e08193fda560abda16ec8e148a13 -package-id
        stm-lifted-0.1.0.0-5ffd887654734508b00d38557df015c7 -package-id
        template-haskell-2.9.0.0-6d27c2b362b15abb1822f2f34b9ae7f9
        -package-id text-1.2.0.4-45eb55624ad282a004669092880e4171
        -package-id time-1.4.2-9b3076800c33f8382c38628f35717951 -package-id
        transformers-0.3.0.0-6458c21515cab7c1cf21e53141557a1c -package-id
        unordered-containers-0.2.5.1-8ffe6daaa4ab199eea69834081d48e0b
        -package-id wai-extra-3.0.6.1-009cf4e7259736a3ff8c320dbf1e8c03
        -package-id wai-logger-2.2.4-6049b7840c9aef87e71e08472741d5b2
        -package-id warp-3.0.11-9f197db6076c8084e07e37fbc55a4221
        -package-id yaml-0.8.10.1-47ea6d594b6aa4f1e4222f42e5ddbd04
        -package-id yesod-1.4.1.4-b83456da1ebd4e9b3f3fa11c35a48f16
        -package-id yesod-auth-1.4.4-a804e0f5c1f7704b50cd8c215c05d482
        -package-id yesod-core-1.4.9.1-361cebfdb60d4cb4439a34467b7d3f4a
        -package-id yesod-form-1.4.4.1-540e6199dd4016b27485d9b1b9d97fbd
        -package-id yesod-static-1.4.0.4-5bad579badf9b60bfa501c0dbe1e7b2f
        -package-id
        yesod-websockets-0.2.1.1-3f9f883803b358a115e960c978edbc3f
        -XHaskell98 -XTemplateHaskell -XQuasiQuotes -XOverloadedStrings
        -XMultiParamTypeClasses -XTypeFamilies -XGADTs
        -XGeneralizedNewtypeDeriving -XFlexibleContexts -XEmptyDataDecls
        -XNoMonomorphismRestriction -XDeriveDataTypeable -XViewPatterns
        -XNoImplicitPrelude -XCPP -Wall -O2
    exe:XXXXXYYYY
        -w -v0 -fbuilding-cabal-package -O -outputdir dist/build -odir
        dist/build -hidir dist/build -stubdir dist/build -i
        -idist/build/XXXXXYYYY -iapp -idist/build -i. -idist/build/autogen
        -Idist/build/XXXXXYYYY -Idist/build/autogen -Idist/build
        -optP-include -optPdist/build/autogen/cabal_macros.h
        -hide-all-packages -no-user-package-db -package-db
        /code/XXXXXYYYY/.cabal-sandbox/x86_64-linux-ghc-7.8.4-packages.conf.d
        -package-id SHA-1.6.4.2-f5b7199ffce4ee302c5d6b679ebe4110
        -package-id XXXXXYYYYLib-0.7.0.10-9336c1d51310d7e40b51dc13cca4c45e
        -package-id aeson-0.8.0.2-183470d27877951223975dbc4efd065f
        -package-id base-4.7.0.2-bfd89587617e381ae01b8dd7b6c7f1c1
        -package-id blaze-html-0.8.0.2-8d75490f5be56eb5a097afb3dd462e1d
        -package-id blaze-markup-0.7.0.2-f401f5962df2bce73b225a204c966d77
        -package-id bytestring-0.10.4.0-d6f1d17d717e8652498cab8269a0acd5
        -package-id conduit-1.2.4-49831f3e5967857a3b25bd2c9ae19eea
        -package-id data-default-0.5.3-080d154f8a51830037b99cc610c6c441
        -package-id data-easy-0.5-592b59d0116bdeda44ff35cb0606086e
        -package-id directory-1.2.1.0-07cd1f59e3c6cac5e3e180019c59a115
        -package-id esqueleto-2.1.2.2-81a7568699d4ec6f80ac2d9c3ab98819
        -package-id fast-logger-2.3.1-c6564998ff9dbd56576dc8ff3ef02140
        -package-id hjsmin-0.1.4.7-99d6cc3104d73a123ecd6f7c1cd6649b
        -package-id http-conduit-2.1.5-bda467660926707461cd01a7f1044a4e
        -package-id markdown-0.1.13.1-0b76712dca68e9ba56567d128fd6f030
        -package-id mime-mail-0.4.8.2-34cd2a2ea86c48a8dc92f6b51dc898c8
        -package-id monad-control-1.0.0.4-6c1f8e5fbca10f10e897dd10e058dbee
        -package-id monad-logger-0.3.13.1-8f4a61421869cdf5cc1e70e2cb6d8991
        -package-id persistent-2.1.2-944c7318a38bb472c849283b87ebe086
        -package-id persistent-mysql-2.1.3-68a28fcd63c00b69483b682babe8472f
        -package-id
        persistent-template-2.1.1-de312de889a88a09f87307ebf2156887
        -package-id random-1.1-092becd083af689459dfd417368314bf -package-id
        safe-0.3.8-2768015ac3c05191f36e05e355f041d5 -package-id
        shakespeare-2.0.4.1-02a5e08193fda560abda16ec8e148a13 -package-id
        stm-lifted-0.1.0.0-5ffd887654734508b00d38557df015c7 -package-id
        template-haskell-2.9.0.0-6d27c2b362b15abb1822f2f34b9ae7f9
        -package-id text-1.2.0.4-45eb55624ad282a004669092880e4171
        -package-id time-1.4.2-9b3076800c33f8382c38628f35717951 -package-id
        transformers-0.3.0.0-6458c21515cab7c1cf21e53141557a1c -package-id
        unordered-containers-0.2.5.1-8ffe6daaa4ab199eea69834081d48e0b
        -package-id wai-extra-3.0.6.1-009cf4e7259736a3ff8c320dbf1e8c03
        -package-id wai-logger-2.2.4-6049b7840c9aef87e71e08472741d5b2
        -package-id warp-3.0.11-9f197db6076c8084e07e37fbc55a4221
        -package-id yaml-0.8.10.1-47ea6d594b6aa4f1e4222f42e5ddbd04
        -package-id yesod-1.4.1.4-b83456da1ebd4e9b3f3fa11c35a48f16
        -package-id yesod-auth-1.4.4-a804e0f5c1f7704b50cd8c215c05d482
        -package-id yesod-core-1.4.9.1-361cebfdb60d4cb4439a34467b7d3f4a
        -package-id yesod-form-1.4.4.1-540e6199dd4016b27485d9b1b9d97fbd
        -package-id yesod-static-1.4.0.4-5bad579badf9b60bfa501c0dbe1e7b2f
        -package-id
        yesod-websockets-0.2.1.1-3f9f883803b358a115e960c978edbc3f
        -XHaskell98 -XTemplateHaskell -XQuasiQuotes -XOverloadedStrings
        -XMultiParamTypeClasses -XTypeFamilies -XGADTs
        -XGeneralizedNewtypeDeriving -XFlexibleContexts -XEmptyDataDecls
        -XNoMonomorphismRestriction -XDeriveDataTypeable -XViewPatterns
        -XNoImplicitPrelude -XCPP -threaded -Wall -O2
GHC search path options:
    Setup.hs
    library
        -w -v0 -fbuilding-cabal-package -O -outputdir dist/build -odir
        dist/build -hidir dist/build -stubdir dist/build -i -idist/build
        -i. -idist/build/autogen -Idist/build/autogen -Idist/build
        -optP-include -optPdist/build/autogen/cabal_macros.h
        -hide-all-packages -no-user-package-db -package-db
        /code/XXXXXYYYY/.cabal-sandbox/x86_64-linux-ghc-7.8.4-packages.conf.d
        -package-id SHA-1.6.4.2-f5b7199ffce4ee302c5d6b679ebe4110
        -package-id XXXXXYYYYLib-0.7.0.10-9336c1d51310d7e40b51dc13cca4c45e
        -package-id aeson-0.8.0.2-183470d27877951223975dbc4efd065f
        -package-id base-4.7.0.2-bfd89587617e381ae01b8dd7b6c7f1c1
        -package-id blaze-html-0.8.0.2-8d75490f5be56eb5a097afb3dd462e1d
        -package-id blaze-markup-0.7.0.2-f401f5962df2bce73b225a204c966d77
        -package-id bytestring-0.10.4.0-d6f1d17d717e8652498cab8269a0acd5
        -package-id conduit-1.2.4-49831f3e5967857a3b25bd2c9ae19eea
        -package-id data-default-0.5.3-080d154f8a51830037b99cc610c6c441
        -package-id data-easy-0.5-592b59d0116bdeda44ff35cb0606086e
        -package-id directory-1.2.1.0-07cd1f59e3c6cac5e3e180019c59a115
        -package-id esqueleto-2.1.2.2-81a7568699d4ec6f80ac2d9c3ab98819
        -package-id fast-logger-2.3.1-c6564998ff9dbd56576dc8ff3ef02140
        -package-id hjsmin-0.1.4.7-99d6cc3104d73a123ecd6f7c1cd6649b
        -package-id http-conduit-2.1.5-bda467660926707461cd01a7f1044a4e
        -package-id markdown-0.1.13.1-0b76712dca68e9ba56567d128fd6f030
        -package-id mime-mail-0.4.8.2-34cd2a2ea86c48a8dc92f6b51dc898c8
        -package-id monad-control-1.0.0.4-6c1f8e5fbca10f10e897dd10e058dbee
        -package-id monad-logger-0.3.13.1-8f4a61421869cdf5cc1e70e2cb6d8991
        -package-id persistent-2.1.2-944c7318a38bb472c849283b87ebe086
        -package-id persistent-mysql-2.1.3-68a28fcd63c00b69483b682babe8472f
        -package-id
        persistent-template-2.1.1-de312de889a88a09f87307ebf2156887
        -package-id random-1.1-092becd083af689459dfd417368314bf -package-id
        safe-0.3.8-2768015ac3c05191f36e05e355f041d5 -package-id
        shakespeare-2.0.4.1-02a5e08193fda560abda16ec8e148a13 -package-id
        stm-lifted-0.1.0.0-5ffd887654734508b00d38557df015c7 -package-id
        template-haskell-2.9.0.0-6d27c2b362b15abb1822f2f34b9ae7f9
        -package-id text-1.2.0.4-45eb55624ad282a004669092880e4171
        -package-id time-1.4.2-9b3076800c33f8382c38628f35717951 -package-id
        transformers-0.3.0.0-6458c21515cab7c1cf21e53141557a1c -package-id
        unordered-containers-0.2.5.1-8ffe6daaa4ab199eea69834081d48e0b
        -package-id wai-extra-3.0.6.1-009cf4e7259736a3ff8c320dbf1e8c03
        -package-id wai-logger-2.2.4-6049b7840c9aef87e71e08472741d5b2
        -package-id warp-3.0.11-9f197db6076c8084e07e37fbc55a4221
        -package-id yaml-0.8.10.1-47ea6d594b6aa4f1e4222f42e5ddbd04
        -package-id yesod-1.4.1.4-b83456da1ebd4e9b3f3fa11c35a48f16
        -package-id yesod-auth-1.4.4-a804e0f5c1f7704b50cd8c215c05d482
        -package-id yesod-core-1.4.9.1-361cebfdb60d4cb4439a34467b7d3f4a
        -package-id yesod-form-1.4.4.1-540e6199dd4016b27485d9b1b9d97fbd
        -package-id yesod-static-1.4.0.4-5bad579badf9b60bfa501c0dbe1e7b2f
        -package-id
        yesod-websockets-0.2.1.1-3f9f883803b358a115e960c978edbc3f
        -XHaskell98 -XTemplateHaskell -XQuasiQuotes -XOverloadedStrings
        -XMultiParamTypeClasses -XTypeFamilies -XGADTs
        -XGeneralizedNewtypeDeriving -XFlexibleContexts -XEmptyDataDecls
        -XNoMonomorphismRestriction -XDeriveDataTypeable -XViewPatterns
        -XNoImplicitPrelude -XCPP -Wall -O2
    exe:XXXXXYYYY
        -w -v0 -fbuilding-cabal-package -O -outputdir dist/build -odir
        dist/build -hidir dist/build -stubdir dist/build -i
        -idist/build/XXXXXYYYY -iapp -idist/build -i. -idist/build/autogen
        -Idist/build/XXXXXYYYY -Idist/build/autogen -Idist/build
        -optP-include -optPdist/build/autogen/cabal_macros.h
        -hide-all-packages -no-user-package-db -package-db
        /code/XXXXXYYYY/.cabal-sandbox/x86_64-linux-ghc-7.8.4-packages.conf.d
        -package-id SHA-1.6.4.2-f5b7199ffce4ee302c5d6b679ebe4110
        -package-id XXXXXYYYYLib-0.7.0.10-9336c1d51310d7e40b51dc13cca4c45e
        -package-id aeson-0.8.0.2-183470d27877951223975dbc4efd065f
        -package-id base-4.7.0.2-bfd89587617e381ae01b8dd7b6c7f1c1
        -package-id blaze-html-0.8.0.2-8d75490f5be56eb5a097afb3dd462e1d
        -package-id blaze-markup-0.7.0.2-f401f5962df2bce73b225a204c966d77
        -package-id bytestring-0.10.4.0-d6f1d17d717e8652498cab8269a0acd5
        -package-id conduit-1.2.4-49831f3e5967857a3b25bd2c9ae19eea
        -package-id data-default-0.5.3-080d154f8a51830037b99cc610c6c441
        -package-id data-easy-0.5-592b59d0116bdeda44ff35cb0606086e
        -package-id directory-1.2.1.0-07cd1f59e3c6cac5e3e180019c59a115
        -package-id esqueleto-2.1.2.2-81a7568699d4ec6f80ac2d9c3ab98819
        -package-id fast-logger-2.3.1-c6564998ff9dbd56576dc8ff3ef02140
        -package-id hjsmin-0.1.4.7-99d6cc3104d73a123ecd6f7c1cd6649b
        -package-id http-conduit-2.1.5-bda467660926707461cd01a7f1044a4e
        -package-id markdown-0.1.13.1-0b76712dca68e9ba56567d128fd6f030
        -package-id mime-mail-0.4.8.2-34cd2a2ea86c48a8dc92f6b51dc898c8
        -package-id monad-control-1.0.0.4-6c1f8e5fbca10f10e897dd10e058dbee
        -package-id monad-logger-0.3.13.1-8f4a61421869cdf5cc1e70e2cb6d8991
        -package-id persistent-2.1.2-944c7318a38bb472c849283b87ebe086
        -package-id persistent-mysql-2.1.3-68a28fcd63c00b69483b682babe8472f
        -package-id
        persistent-template-2.1.1-de312de889a88a09f87307ebf2156887
        -package-id random-1.1-092becd083af689459dfd417368314bf -package-id
        safe-0.3.8-2768015ac3c05191f36e05e355f041d5 -package-id
        shakespeare-2.0.4.1-02a5e08193fda560abda16ec8e148a13 -package-id
        stm-lifted-0.1.0.0-5ffd887654734508b00d38557df015c7 -package-id
        template-haskell-2.9.0.0-6d27c2b362b15abb1822f2f34b9ae7f9
        -package-id text-1.2.0.4-45eb55624ad282a004669092880e4171
        -package-id time-1.4.2-9b3076800c33f8382c38628f35717951 -package-id
        transformers-0.3.0.0-6458c21515cab7c1cf21e53141557a1c -package-id
        unordered-containers-0.2.5.1-8ffe6daaa4ab199eea69834081d48e0b
        -package-id wai-extra-3.0.6.1-009cf4e7259736a3ff8c320dbf1e8c03
        -package-id wai-logger-2.2.4-6049b7840c9aef87e71e08472741d5b2
        -package-id warp-3.0.11-9f197db6076c8084e07e37fbc55a4221
        -package-id yaml-0.8.10.1-47ea6d594b6aa4f1e4222f42e5ddbd04
        -package-id yesod-1.4.1.4-b83456da1ebd4e9b3f3fa11c35a48f16
        -package-id yesod-auth-1.4.4-a804e0f5c1f7704b50cd8c215c05d482
        -package-id yesod-core-1.4.9.1-361cebfdb60d4cb4439a34467b7d3f4a
        -package-id yesod-form-1.4.4.1-540e6199dd4016b27485d9b1b9d97fbd
        -package-id yesod-static-1.4.0.4-5bad579badf9b60bfa501c0dbe1e7b2f
        -package-id
        yesod-websockets-0.2.1.1-3f9f883803b358a115e960c978edbc3f
        -XHaskell98 -XTemplateHaskell -XQuasiQuotes -XOverloadedStrings
        -XMultiParamTypeClasses -XTypeFamilies -XGADTs
        -XGeneralizedNewtypeDeriving -XFlexibleContexts -XEmptyDataDecls
        -XNoMonomorphismRestriction -XDeriveDataTypeable -XViewPatterns
        -XNoImplicitPrelude -XCPP -threaded -Wall -O2

Also, I've built this code inside docker container today for some production tests (also project was temporary sandboxed). After that I had another error:

$ ghc-mod check Application.hs
info: loadTargets: Switching to LinkInMemory/HscInterpreted (memory hungry)
Error: bytecode compiler can't handle unboxed tuples.  Possibly due to foreign import/export decls in source.  Workaround: use -fobject-code, or compile this module to .o separately.

Finally, all errors are gone again and all checks succeed now. Please excuse me, I feel myself very stupid because of such confusing reports.

DanielG commented 9 years ago

Odd the module Application is reachable from both the library and the exe component so ghc-mod really shouldn't have fallen back to the sandbox opts. Though I did just find a bug in the component selection code I don't think it's related. I just added a new debugging command locally that might help though I'll finish that up and give you a poke when it's pushed.

The unboxed tuples thing is a known issue with a known fix that I seem to have forgotten about: https://github.com/kazu-yamamoto/ghc-mod/issues/451. Basically just use-g -O0 for now.

What did you do to make everything succeed?

DanielG commented 9 years ago

Oh actually I think I have an idea the paths above should all be absolute, in the version you have there was one function that didn't canonical the paths it returns but to search for matching modules IIRC I just do (==) so that might be why ghc-mod is not finding the Application module in the module graph.

geraldus commented 9 years ago

module Application is reachable from both the library and the exe component

Module Application is exposed module of library only, there are no exposed-modules or other-modules sections for executable component in cabal file at all.

What did you do to make everything succeed?

I didn't done anything special. I've just plugged my project as volume in docker image; logged in docker image, initiated sandbox, and built the project. As I can see, there was a sandbox when I've done ghc-mod debug (from host OS), but now I have sandbox deleted and no errors occur.

I hope it was helpful a bit! Will be glad to test new versions.

DanielG commented 9 years ago

On Mon, Apr 13, 2015 at 01:44:57AM -0700, Артур Файзрахманов wrote:

module Application is reachable from both the library and the exe component

Module Application is exposed module of library only, there are no exposed-modules or other-modules sections for executable component in cabal file at all.

That doesn't matter ghc-mod does transitive module dependecy resolution now; look at the HomeModuleGraph tests if you're curious how it works. So if Application is in the executable's transitive module closure then ghc-mod knows about it ;) Looking at the module graph in the ghc-mod debug output it looks like app/main.hs imports Application.

I didn't done anything special. I've just plugged my project as volume in docker image; logged in docker image, initiated sandbox, and built the project. As I can see, there was a sandbox when I've done ghc-mod debug (from host OS), but now I have sandbox deleted and no errors occur.

So what was that about the error you got in docker first then? I though you meant you brought up the docker container, ran ghc-mod then you got that error but then you say that error dissapered somehow.

I hope it was helpful a bit! Will be glad to test new versions.

I just pushed a few more changes I'm curious if it still happens now.

Either way there should now be a new command debugComponent that tells you more about what components ghc-mod thinks a certain module or file belongs to.

Use it like:

$ ghc-mod debugComponent "/Path/To/Module.hs"

(I just found a bug in that though looks like it only accepts absolute paths for now :x)

geraldus commented 9 years ago

So what was that about the error you got in docker first then

I've used docker to build executable for production only (i.e. to make build in same environment as my VPS have). I do all development under OS X (and ghc-mod also lives in OS X only), so I just wanted to say, that I didn't done anything special, also there was no changes is code.

I just pushed a few more changes

Ok, I'll be able to rebuild ghc-mod this evening.

geraldus commented 9 years ago

Looks like it could be closed now.