Skip to content
  • Sebastian Graf's avatar
    e571eda7
    Pmc: Implement `considerAccessible` (#18610) · e571eda7
    Sebastian Graf authored and Marge Bot's avatar Marge Bot committed
    Consider (`T18610`):
    ```hs
      f :: Bool -> Int
      f x = case (x, x) of
        (True,  True)  -> 1
        (False, False) -> 2
        (True,  False) -> 3 -- Warning: Redundant
    ```
    The third clause will be flagged as redundant. Nevertheless, the
    programmer might intend to keep the clause in order to avoid bitrot.
    
    After this patch, the programmer can write
    ```hs
      g :: Bool -> Int
      g x = case (x, x) of
        (True,  True)  -> 1
        (False, False) -> 2
        (True,  False) | GHC.Exts.considerAccessible -> 3 -- No warning
    ```
    And won't be bothered any longer. See also `Note [considerAccessible]`
    and the updated entries in the user's guide.
    
    Fixes #18610 and #19228.
    e571eda7
    Pmc: Implement `considerAccessible` (#18610)
    Sebastian Graf authored and Marge Bot's avatar Marge Bot committed
    Consider (`T18610`):
    ```hs
      f :: Bool -> Int
      f x = case (x, x) of
        (True,  True)  -> 1
        (False, False) -> 2
        (True,  False) -> 3 -- Warning: Redundant
    ```
    The third clause will be flagged as redundant. Nevertheless, the
    programmer might intend to keep the clause in order to avoid bitrot.
    
    After this patch, the programmer can write
    ```hs
      g :: Bool -> Int
      g x = case (x, x) of
        (True,  True)  -> 1
        (False, False) -> 2
        (True,  False) | GHC.Exts.considerAccessible -> 3 -- No warning
    ```
    And won't be bothered any longer. See also `Note [considerAccessible]`
    and the updated entries in the user's guide.
    
    Fixes #18610 and #19228.
Loading