Skip to content

vecToTuple not needed anymore #2830

Open
@leonschoorl

Description

@leonschoorl
foo :: Vec 2 Bool -> Bool
foo xs = x && y
 where
   x :> y :> _ = xs

Starting with GHC 9.2 this produces warnings with -Wall enabled:

Blaat.hs:6:4: warning: [-Wincomplete-uni-patterns]
    Pattern match(es) are non-exhaustive
    In a pattern binding:
        Patterns of type ‘Vec 2 Bool’ not matched:
            Cons _ _
            :> _ (Cons _ _)
  |
6 |    x :> y :> _ = xs
  |    ^^^^^^^^^^^^^^^^

To workaround that we added vecToTuple in #2682:

foo :: Vec 2 Bool -> Bool
foo xs = x && y
 where
   (x, y) = vecToTuple xs

But I just discovered that since the addition of the COMPLETE pragma in #2716 the original code now compiles warning free.

And while vecToTuple was backported to the 1.8 branch, it hasn't made it into a released version yet.

I think we should revert the introduction of vecToTuple. (and backport #2716 to 1.8)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions