GithubHelp home page GithubHelp logo

Comments (16)

swt2c avatar swt2c commented on June 10, 2024 1

Thanks @ivanperez-keera I'll try putting that patch in tonight.

from copilot.

swt2c avatar swt2c commented on June 10, 2024 1

Thanks @ivanperez-keera, I can confirm this patch gets copilot back to a green board in Debian (ignore mips64el). :-)

image

from copilot.

ivanperez-keera avatar ivanperez-keera commented on June 10, 2024

Thanks a lot! Will review it and get back to you.

from copilot.

swt2c avatar swt2c commented on June 10, 2024

Are you able to reproduce this one locally, or do you need any more info from me on it?

from copilot.

ivanperez-keera avatar ivanperez-keera commented on June 10, 2024

I'm trying to reproduce it in a docker container with GHC 9.4.7 and Cabal 3.8. Cabal is giving me headaches: haskell/cabal#9444.

from copilot.

ivanperez-keera avatar ivanperez-keera commented on June 10, 2024

I managed to reproduce the problem.

from copilot.

swt2c avatar swt2c commented on June 10, 2024

Hey Ivan, just checking in to see if this was looking relatively easy to fix, or whether it might take a bit to sort out. I think this is the last (known) blocker in getting copilot updated in Debian. Obviously not the most urgent issue in the world, though. :-)

from copilot.

ivanperez-keera avatar ivanperez-keera commented on June 10, 2024

Hi. I'm hoping we'll be able to fix this soon. I don't know if I'll be able to find time this week but I'll do everything I can. If not, I'll prioritize fixing this by next week.

And thanks for following up on this! Having Copilot in Debian is a big deal for us and your support to make that happen is invaluable :)

from copilot.

ivanperez-keera avatar ivanperez-keera commented on June 10, 2024

@swt2c I was able to find the solution. I'll try to push this soon.

If you want to backport this change to Copilot 3.17 on Debian, here's the diff:

diff --git a/copilot-language/tests/Test/Copilot/Language/Reify.hs b/copilot-language/tests/Test/Copilot/Language/Reify.hs
index e056d946..d724df73 100644
--- a/copilot-language/tests/Test/Copilot/Language/Reify.hs
+++ b/copilot-language/tests/Test/Copilot/Language/Reify.hs
@@ -31,7 +31,7 @@ import qualified Copilot.Language.Operators.Integral as Copilot
 import qualified Copilot.Language.Operators.Mux      as Copilot
 import qualified Copilot.Language.Operators.Ord      as Copilot
 import           Copilot.Language.Reify              (reify)
-import           Copilot.Language.Spec               (observer)
+import           Copilot.Language.Spec               (Spec, observer)
 import           Copilot.Language.Stream             (Stream)
 import qualified Copilot.Language.Stream             as Copilot
 
@@ -732,7 +732,8 @@ semanticsShowK steps (SemanticsP (expr, exprList)) =
 checkSemanticsP :: Int -> [a] -> SemanticsP -> IO Bool
 checkSemanticsP steps _streams (SemanticsP (expr, exprList)) = do
     -- Spec with just one observer of one expression.
-    let spec = observer testObserverName expr
+    let spec :: Spec
+        spec = observer testObserverName expr
 
     -- Reified stream (low-level)
     llSpec <- reify spec

from copilot.

ivanperez-keera avatar ivanperez-keera commented on June 10, 2024

Description

copilot-language's tests fail to compile with GHC 9.4. Prior versions made arbitrary decisions during type interfence, and the new type checker will simply reject such programs.

Type

  • Bug: test fails to compile.

Additional context

None.

Requester

  • Scott Talbert (Debian Developer & Debian Haskell Group)

Method to check presence of bug

Compiling copilot-language's tests with GHC 9.4.7 results in an error message:

# cabal test .
Build profile: -w ghc-9.4.7 -O1
In order, the following will be built (use -v for more details):
 - copilot-language-3.17 (test:unit-tests) (first run)
Preprocessing test suite 'unit-tests' for copilot-language-3.17..
Building test suite 'unit-tests' for copilot-language-3.17..
[2 of 3] Compiling Test.Copilot.Language.Reify ( tests/Test/Copilot/Language/Reify.hs, /root/copilot/dist-newstyle/build/x86_64-linux/ghc-9.4.7/copilot-language-3.17/t/unit-tests/build/unit-tests/unit-tests-tmp/Test/Copilot/Language/Reify.o )

tests/Test/Copilot/Language/Reify.hs:737:16: error:
    * Could not deduce (Copilot.Core.Type.Struct t)
        arising from a superclass required to satisfy `Typed t',
        arising from a use of `observer'
      from the context: (Read t, Eq t, Typed t, Arbitrary t)
        bound by a pattern with constructor:
                   SemanticsP :: forall t.
                                 (Typeable t, Read t, Eq t, Show t, Typed t, Arbitrary t) =>
                                 ((Typeable t, Read t, Eq t, Show t, Typed t, Arbitrary t) =>
                                  (Stream t, [t]))
                                 -> SemanticsP,
                 in an equation for `checkSemanticsP'
        at tests/Test/Copilot/Language/Reify.hs:734:33-59
      Possible fix:
        add (Copilot.Core.Type.Struct t) to the context of
          the data constructor `SemanticsP'
    * In the expression: observer testObserverName expr
      In an equation for `spec': spec = observer testObserverName expr
      In the expression:
        do let spec = observer testObserverName expr
           llSpec <- reify spec
           let trace = eval Haskell steps llSpec
           let expectation = take steps exprList
           ....
    |
737 |         spec = observer testObserverName expr

Expected result

The above tests should compile without errors.

Desired result

The above tests should compile without errors.

Proposed solution

Add type annotations in checkSemanticsP.

Further notes

None.

from copilot.

ivanperez-keera avatar ivanperez-keera commented on June 10, 2024

Change Manager: Confirmed that the issue manifests with GHC 9.4.

from copilot.

ivanperez-keera avatar ivanperez-keera commented on June 10, 2024

Technical Lead: Confirmed that the issue should be addressed.

from copilot.

ivanperez-keera avatar ivanperez-keera commented on June 10, 2024

Technical Lead: Bug scheduled for fixing in Copilot 3.18.

Fix assigned to: @ivanperez-keera.

from copilot.

ivanperez-keera avatar ivanperez-keera commented on June 10, 2024

Implementor: Solution implemented, review requested.

from copilot.

ivanperez-keera avatar ivanperez-keera commented on June 10, 2024

Change Manager: Verified that:

  • Solution is implemented:
    • The code proposed compiles and passes all tests. Details:
      Build log: https://app.travis-ci.com/github/Copilot-Language/copilot/builds/267903584
    • The solution proposed produces the expected result. Details:
      The following Dockerfile checks that copilot-language compiles with GHC 9.4, in which case it prints the message Success:
      FROM ubuntu:focal
      
      RUN apt-get update
      
      RUN apt-get install --yes libz-dev
      RUN apt-get install --yes git
      
      RUN apt-get install --yes wget
      RUN mkdir -p $HOME/.ghcup/bin
      RUN wget https://downloads.haskell.org/~ghcup/0.1.19.2/x86_64-linux-ghcup-0.1.19.2 -O $HOME/.ghcup/bin/ghcup
      
      RUN chmod a+x $HOME/.ghcup/bin/ghcup
      ENV PATH=$PATH:/root/.ghcup/bin/
      ENV PATH=$PATH:/root/.cabal/bin/
      RUN apt-get install --yes curl
      RUN apt-get install --yes gcc make libgmp3-dev g++
      
      SHELL ["/bin/bash", "-c"]
      
      RUN ghcup install ghc 9.4.7
      RUN ghcup install cabal 3.8
      RUN ghcup set ghc 9.4.7
      RUN cabal update
      
      CMD git clone $REPO && \
          cd $NAME && \
          git checkout $COMMIT && \
          cd copilot-language && \
          cabal test . && \
          echo Success
      Command (substitute variables based on new path after merge):
      docker run -e "REPO=https://github.com/ivanperez-keera/copilot" -e "NAME=copilot" -e "COMMIT=e25c7afaf743a5fdc7a9638516f59b006383bef0" -it copilot-verify-469
      
  • Implementation is documented. Details:
    Internal change; no changes to the documentation are needed, and a comment is added to ensure that future revisions do not remove the change accidentally.
  • Change history is clear.
  • Commit messages are clear.
  • Changelogs are updated.
  • Examples are updated. Details:
    No updates needed.
  • Required version bumps are evaluated. Details:
    Bump not needed (internal change to tests; does not affect API).

from copilot.

ivanperez-keera avatar ivanperez-keera commented on June 10, 2024

Change Manager: Implementation ready to be merged.

from copilot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.