Skip to content

copilot-theorem: Code contains unused pragmas #613

Closed

Description

@ivanperez-keera

Description

The code of copilot-theorem contains unused language pragmas. To comply with our coding style, which required unused code not to be included in the codebase, those pragmas should be removed.

Type

  • Management: comply with styling requirement.

Additional context

None.

Requester

  • Ivan Perez.

Method to check presence of bug

Not applicable (not a bug).

Expected result

The code contains no unused pragmas. Running hlint with the following auxiliary file indicates that there are no unused PRAGMAS.

- ignore: {name: "Redundant bracket"}
- ignore: {name: "Use infix"}
- ignore: {name: "Redundant as"}
- ignore: {name: "Redundant <$>"}
- ignore: {name: "Use camelCase"}
- ignore: {name: "Avoid lambda"}
- ignore: {name: "Use gets"}
- ignore: {name: "Redundant $"}
- ignore: {name: "Use <&>"}
- ignore: {name: "Use concatMap"}
- ignore: {name: "Move brackets to avoid $"}
- ignore: {name: "Use /="}
- ignore: {name: "Use newtype instead of data"}
- ignore: {name: "Use :"}
- ignore: {name: "Replace case with fromMaybe"}
- ignore: {name: "Use >=>"}
- ignore: {name: "Use curry"}
- ignore: {name: "Use first"}
- ignore: {name: "Use hPrint"}
- ignore: {name: "Use or"}
- ignore: {name: "Use fmap"}
- ignore: {name: "Use if"}
- ignore: {name: "Use <$>"}
- ignore: {name: "Reduce duplication"}
- ignore: {name: "Eta reduce"}

Desired result

The code contains no unused pragmas. Running hlint with the following auxiliary file indicates that there are no unused PRAGMAS.

- ignore: {name: "Redundant bracket"}
- ignore: {name: "Use infix"}
- ignore: {name: "Redundant as"}
- ignore: {name: "Redundant <$>"}
- ignore: {name: "Use camelCase"}
- ignore: {name: "Avoid lambda"}
- ignore: {name: "Use gets"}
- ignore: {name: "Redundant $"}
- ignore: {name: "Use <&>"}
- ignore: {name: "Use concatMap"}
- ignore: {name: "Move brackets to avoid $"}
- ignore: {name: "Use /="}
- ignore: {name: "Use newtype instead of data"}
- ignore: {name: "Use :"}
- ignore: {name: "Replace case with fromMaybe"}
- ignore: {name: "Use >=>"}
- ignore: {name: "Use curry"}
- ignore: {name: "Use first"}
- ignore: {name: "Use hPrint"}
- ignore: {name: "Use or"}
- ignore: {name: "Use fmap"}
- ignore: {name: "Use if"}
- ignore: {name: "Use <$>"}
- ignore: {name: "Reduce duplication"}
- ignore: {name: "Eta reduce"}

Proposed solution

Remove all unused PRAGMAS from the code in copilot-theorem.

Further notes

None.

Activity

  1. added
    CR:Status:InitiatedAdmin only: Change request that has been initiated
    CR:Type:ManagementAdmin only: Change request for conformance with policies or procedures
    on Mar 29, 2025
  2. changed the title [-]`copilot-theorem`: Code contains unused PRAGMAS[/-] [+]`copilot-theorem`: Code contains unused pragmas[/+] on Mar 29, 2025
  3. ivanperez-keera commented on Mar 29, 2025

    @ivanperez-keera
    MemberAuthor

    Change Manager: Confirmed that the issue exists.

  4. added
    CR:Status:ConfirmedAdmin only: Change request that has been acknowledged by the change manager
    and removed
    CR:Status:InitiatedAdmin only: Change request that has been initiated
    on Mar 29, 2025
  5. ivanperez-keera commented on Mar 29, 2025

    @ivanperez-keera
    MemberAuthor

    Technical Lead: Confirmed that the issue should be addressed.

  6. added
    CR:Status:AcceptedAdmin only: Change request accepted by technical lead
    and removed
    CR:Status:ConfirmedAdmin only: Change request that has been acknowledged by the change manager
    on Mar 29, 2025
  7. ivanperez-keera commented on May 13, 2025

    @ivanperez-keera
    MemberAuthor

    Technical Lead: Issue scheduled for fixing in Copilot 4.5.

    Fix assigned to: @carte731.

  8. added
    CR:Status:ScheduledAdmin only: Change requested scheduled
    and removed
    CR:Status:AcceptedAdmin only: Change request accepted by technical lead
    on May 13, 2025
  9. added this to the 4.5 milestone on May 13, 2025
  10. carte731 commented on May 29, 2025

    @carte731
    Collaborator

    cpt_613.txt
    Update: generated text file with 'hlint' and currently I'm working through the document looking for unused pragmas.

  11. carte731 commented on May 29, 2025

    @carte731
    Collaborator

    Current listing of unused pragmas in Copilot-Theorem:

    copilot-theorem/src/Copilot/Theorem/What4.hs:4:1-43: Warning: Unused LANGUAGE pragma
    Found:
    {-# LANGUAGE GeneralizedNewtypeDeriving #-}
    Perhaps you should remove it.

    copilot-theorem/src/Copilot/Theorem/What4.hs:7:1-43: Warning: Unused LANGUAGE pragma
    Found:
    {-# LANGUAGE MultiWayIf #-}
    Perhaps you should remove it.

    copilot-theorem/src/Copilot/Theorem/What4.hs:11:1-43: Warning: Unused LANGUAGE pragma
    Found:
    {-# LANGUAGE StandaloneDeriving #-}
    Perhaps you should remove it.

    copilot-theorem/src/Copilot/Theorem/What4.hs:12:1-43: Warning: Unused LANGUAGE pragma
    Found:
    {-# LANGUAGE TemplateHaskell #-}
    Perhaps you should remove it.
    Note: may require {-# LANGUAGE TemplateHaskellQuotes #-} adding to the top of the file

    copilot-theorem/src/Copilot/Theorem/What4.hs:13:1-43: Warning: Unused LANGUAGE pragma
    Found:
    {-# LANGUAGE TupleSections #-}
    Perhaps you should remove it.

    copilot-theorem/src/Copilot/Theorem/Kind2/Prover.hs:1:1-28: Warning: Unused LANGUAGE pragma
    Found:
    {-# LANGUAGE LambdaCase #-}
    Perhaps you should remove it.

    copilot-theorem/src/Copilot/Theorem/Prover/SMTIO.hs:1:1-31: Warning: Unused LANGUAGE pragma
    Found:
    {-# LANGUAGE LambdaCase #-}
    Perhaps you should remove it.

  12. 7 remaining items

  13. carte731 commented on Jul 3, 2025

    @carte731
    Collaborator

    Implementor: Fix implemented, review requested.

  14. ivanperez-keera commented on Jul 5, 2025

    @ivanperez-keera
    MemberAuthor

    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/275653840
      • The solution proposed produces the expected result. Details:
        The following dockerfile runs hlint on copilot-theorem with the provided list of ignored warnings, which does not include unnecessary language pragmas, and checks that there are no warnings reported, after which it prints the message success:
        --- Dockerfile-verify-613
        FROM ubuntu:jammy
        
        ENV DEBIAN_FRONTEND=noninteractive
        
        RUN apt-get update
        
        RUN apt-get install --yes git
        RUN apt-get install --yes hlint
        
        ADD ignore.yaml /tmp/ignore.yaml
        
        RUN hlint --version
        
        SHELL ["/bin/bash", "-c"]
        CMD git clone $REPO \
            && cd $NAME \
            && git checkout $COMMIT \
            && hlint -h /tmp/ignore.yaml copilot-theorem/src \
            && echo "Success"
        
        --- ignore.yaml
        - ignore: {name: "Redundant bracket"}
        - ignore: {name: "Use infix"}
        - ignore: {name: "Redundant as"}
        - ignore: {name: "Redundant <$>"}
        - ignore: {name: "Use camelCase"}
        - ignore: {name: "Avoid lambda"}
        - ignore: {name: "Use gets"}
        - ignore: {name: "Redundant $"}
        - ignore: {name: "Use <&>"}
        - ignore: {name: "Use concatMap"}
        - ignore: {name: "Move brackets to avoid $"}
        - ignore: {name: "Use /="}
        - ignore: {name: "Use newtype instead of data"}
        - ignore: {name: "Use :"}
        - ignore: {name: "Replace case with fromMaybe"}
        - ignore: {name: "Use >=>"}
        - ignore: {name: "Use curry"}
        - ignore: {name: "Use first"}
        - ignore: {name: "Use hPrint"}
        - ignore: {name: "Use or"}
        - ignore: {name: "Use fmap"}
        - ignore: {name: "Use if"}
        - ignore: {name: "Use <$>"}
        - ignore: {name: "Reduce duplication"}
        - ignore: {name: "Eta reduce"}
        
        Command (substitute variables based on new path after merge):
        $ docker run -e REPO=https://github.com/carte731/copilot -e NAME=copilot -e COMMIT=c9954d663f2988b2db9bd8ce65f9f14e71512195 copilot-verify-613
        
    • Implementation is documented. Details:
      No updates needed; the PR removes pragmas but does not otherwise alter or add code.
    • Change history is clear.
    • Commit messages are clear.
    • Changelogs are updated.
    • Examples are updated. Details:
      No updates needed; the PR removes pragmas but does not otherwise alter or add code, nor are examples affected.
    • Author is internal or has provided signed CLA.
    • Required version bumps are evaluated. Details:
      Bump not needed; change removes pragmas but does not affect the public API.
  15. ivanperez-keera commented on Jul 5, 2025

    @ivanperez-keera
    MemberAuthor

    Change Manager: Implementation ready to be merged.

  16. added a commit that references this issue on Jul 6, 2025
    e95cc62
  17. added
    CR:Status:ClosedAdmin only: Change request that has been completed
    and removed
    CR:Status:VerificationAdmin only: Change request that is currently being verified
    on Jul 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

CR:Status:ClosedAdmin only: Change request that has been completedCR:Type:ManagementAdmin only: Change request for conformance with policies or procedures

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions