Skip to content

Incomplete pattern warning when matching both Nil and Cons #107

Description

@flhorizon

Hello, I'm getting this warning for a pattern usage like:

foo :: DList a -> IO ()
foo Nil = putStrLn "empty!"
foo (Cons x xs) = print $ x:xs
warning: [-Wincomplete-patterns]
    Pattern match(es) are non-exhaustive
    In an equation for ‘foo’:
        Patterns not matched: _ 

My understanding using pattern synonyms, is that the implementer needs to tell the compiler which pattern set should be considered as complete:

{-# COMPLETE Nil, Cons #-}

Would you accept a PR for that?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions