Skip to content

copilot-theorem: Remove uses of LambdaCase #736

@ivanperez-keera

Description

@ivanperez-keera

Description

copilot-theorem uses the LambdaCase language extension. There is a preference for a simpler version of Copilot and minimizing the extensions used.

Since LambdaCase does not really save much code and is not really needed, it should be removed from the codebase.

Type

  • Management: Compliance with style guide.

Additional context

None.

Requester

  • Ivan Perez.

Method to check presence of bug

While we cannot programmatically check whether LambdaCase is or is not needed, we can check that it is present by running grep on the codebase:

$ grep -nHre 'LambdaCase' --include='*.hs' 
copilot-theorem/src/Copilot/Theorem/TransSys/Operators.hs:3:{-# LANGUAGE LambdaCase                #-}
copilot-theorem/src/Copilot/Theorem/Prover/SMT.hs:3:{-# LANGUAGE LambdaCase        #-}
copilot-theorem/src/Copilot/Theorem/Prover/TPTP.hs:2:{-# LANGUAGE LambdaCase #-}
copilot-theorem/src/Copilot/Theorem/Prover/Z3.hs:4:{-# LANGUAGE LambdaCase            #-}
copilot-theorem/src/Copilot/Theorem/IL/Spec.hs:3:{-# LANGUAGE LambdaCase                #-}
copilot-theorem/src/Copilot/Theorem/IL/Transform.hs:1:{-# LANGUAGE LambdaCase #-}
copilot-theorem/src/Copilot/Theorem/IL/Translate.hs:2:{-# LANGUAGE LambdaCase          #-}
copilot-theorem/src/Copilot/Theorem/What4.hs:5:{-# LANGUAGE LambdaCase          #-}

Note that the module Copilot.Theorem.Prover.Z3 is no longer needed, so its use of LambdaCase can be ignored.

Expected result

No modules in Copilot use LambdaCase.

Desired result

No modules in Copilot use LambdaCase.

Proposed solution

Replace all uses of \case with \<variable> -> case <variable> of across the codebase, where <variable> is a variable name that matches the input to which case selection is being applied.

Remove LambdaCase from the list of extensions used by all files.

Further notes

None.

Metadata

Metadata

Assignees

No one assigned

    Labels

    CR:Status:AcceptedAdmin only: Change request accepted by technical leadCR:Type:ManagementAdmin only: Change request for conformance with policies or procedures

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions