sergei-mironov / vkhs

Haskell library dealing with vkontakte social network
BSD 3-Clause "New" or "Revised" License
12 stars 6 forks source link

Does not compile with ghc > 8.2.2 #19

Closed Donaim closed 5 years ago

Donaim commented 5 years ago

Hi, I am using VKHS in my stack project and my build fails at compile step: $ stack build

flippers-1.0.1: configure
flippers-1.0.1: build
mtlparse-0.1.4.0: configure
flippers-1.0.1: copy/register
mtlparse-0.1.4.0: build
mtlparse-0.1.4.0: copy/register
regexpr-0.5.4: configure
regexpr-0.5.4: build
regexpr-0.5.4: copy/register
VKHS-1.9.2: configure
VKHS-1.9.2: build
Progress 4/5

--  While building package VKHS-1.9.2 using:
      /home/user/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_2.4.0.1_ghc-8.6.4 --builddir=.stack-work/dist/x86_64-linux/Cabal-2.4.0.1 build --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1
    Logs have been written to: /tmp/vkbot/.stack-work/logs/VKHS-1.9.2.log

    Configuring VKHS-1.9.2...
    Preprocessing library for VKHS-1.9.2..
    Building library for VKHS-1.9.2..
    [ 1 of 16] Compiling Network.Shpider.Pairs ( src/Network/Shpider/Pairs.hs, .stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/Network/Shpider/Pairs.o )
    [ 2 of 16] Compiling Network.Shpider.TextUtils ( src/Network/Shpider/TextUtils.hs, .stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/Network/Shpider/TextUtils.o )
    [ 3 of 16] Compiling Text.HTML.TagSoup.Parsec ( src/Text/HTML/TagSoup/Parsec.hs, .stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/Text/HTML/TagSoup/Parsec.o )
    [ 4 of 16] Compiling Network.Shpider.Forms ( src/Network/Shpider/Forms.hs, .stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/Network/Shpider/Forms.o )
    [ 5 of 16] Compiling Text.Namefilter  ( src/Text/Namefilter.hs, .stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/Text/Namefilter.o )
    [ 6 of 16] Compiling Text.PFormat     ( src/Text/PFormat.hs, .stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/Text/PFormat.o )
    [ 7 of 16] Compiling Web.VKHS.Imports ( src/Web/VKHS/Imports.hs, .stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/Web/VKHS/Imports.o )

    /tmp/stack126276/VKHS-1.9.2/src/Web/VKHS/Imports.hs:108:29: warning: [-Wname-shadowing]
        This binding for ‘i’ shadows the existing binding
          bound at src/Web/VKHS/Imports.hs:108:9
        |
    108 | whileM_ i f = whileM i () (\i () -> (,()) <$> f i)
        |                             ^
    [ 8 of 16] Compiling Web.VKHS.Types   ( src/Web/VKHS/Types.hs, .stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/Web/VKHS/Types.o )

    /tmp/stack126276/VKHS-1.9.2/src/Web/VKHS/Types.hs:19:1: warning: [-Wdodgy-imports]
        The import item ‘NominalDiffTime(..)’ suggests that
        ‘NominalDiffTime’ has (in-scope) constructors or class methods,
        but it has none
       |
    19 | import Data.Time (secondsToDiffTime,NominalDiffTime(..),UTCTime(..),diffUTCTime)
       | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    [ 9 of 16] Compiling Web.VKHS.Client  ( src/Web/VKHS/Client.hs, .stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/Web/VKHS/Client.o )

    /tmp/stack126276/VKHS-1.9.2/src/Web/VKHS/Client.hs:281:3: error:
        • Could not deduce (Control.Monad.Fail.MonadFail m)
            arising from a do statement
            with the failable pattern ‘(Right ClientRequest {..})’
          from the context: MonadClient m s
            bound by the type signature for:
                       downloadFileWith :: forall (m :: * -> *) s.
                                           MonadClient m s =>
                                           URL -> (ByteString -> IO ()) -> m ()
            at src/Web/VKHS/Client.hs:278:1-77
          Possible fix:
            add (Control.Monad.Fail.MonadFail m) to the context of
              the type signature for:
                downloadFileWith :: forall (m :: * -> *) s.
                                    MonadClient m s =>
                                    URL -> (ByteString -> IO ()) -> m ()
        • In a stmt of a 'do' block:
            (Right ClientRequest {..}) <- requestCreateGet
                                            url (cookiesCreate ())
          In the expression:
            do (ClientState {..}) <- toClientState <$> get
               (Right ClientRequest {..}) <- requestCreateGet
                                               url (cookiesCreate ())
               liftIO $ Pipes.withHTTP req cl_man $ \ resp -> do ...
          In an equation for ‘downloadFileWith’:
              downloadFileWith url h
                = do (ClientState {..}) <- toClientState <$> get
                     (Right ClientRequest {..}) <- requestCreateGet
                                                     url (cookiesCreate ())
                     liftIO $ Pipes.withHTTP req cl_man $ \ resp -> ...
        |
    281 |   (Right ClientRequest{..}) <- requestCreateGet url (cookiesCreate ())
        |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
****

My stack config (package.yaml) file:

name:                vkbot
version:             0.1.0.0
github:              "githubuser/vkbot"
license:             BSD3
author:              "Donaim"
maintainer:          "3Donaim@gmail.com"
copyright:           "2019 Donaim"

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

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

# 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/githubuser/vkbot#readme>

dependencies:
- base >= 4.6 && < 5
- VKHS == 1.9.2
- regexpr == 0.5.4

library:
  source-dirs: src

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

tests:
  coinbot-test:
    main:                Spec.hs
    source-dirs:         test
    ghc-options:
    - -threaded
    - -rtsopts
    - -with-rtsopts=-N
    dependencies:
    - vkbot
Donaim commented 5 years ago

Update: different error with GHC-8.4.3

    [12 of 16] Compiling Web.VKHS.API.Types ( src/Web/VKHS/API/Types.hs, .stack-work/dist/x86_64-linux/Cabal-2.2.0.1/build/Web/VKHS/API/Types.o )

    /tmp/stack160016/VKHS-1.9.2/src/Web/VKHS/API/Types.hs:206:10: error:
        • Could not deduce (Semigroup (Sized a))
            arising from the superclasses of an instance declaration
          from the context: Monoid a
            bound by the instance declaration
            at src/Web/VKHS/API/Types.hs:206:10-37
        • In the instance declaration for ‘Monoid (Sized a)’
        |
    206 | instance Monoid a => Monoid (Sized a) where
        |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Donaim commented 5 years ago

Update: Sucessfully compiles with GHC-8.2.2 Please add info about GHC version

sergei-mironov commented 5 years ago

Hi, thank you for the report. I plan to look into it this week. Thanks.

sergei-mironov commented 5 years ago

I added the Semigroup instance required by GHC-8.4.4 and make it the default. Also README now contains instructions on how to check GHC version which is known to work. I am closing the issue now, please re-open if you need more help.