[Haskell-cafe] incomplete-uni-patterns

Viktor Dukhovni ietf-dane at dukhovni.org
Thu Jan 26 00:40:27 UTC 2023


On Wed, Jan 25, 2023 at 04:29:08PM -0800, Jeff Clites via Haskell-Cafe wrote:

> Does this suppress the warning?:
> 
>   let ~[addr,port] = args
> 
> and
> 
>   let ~(Just val) = mval

I would expect that, and indeed:

    $ ghci -Wall
    GHCi, version 9.4.4: https://www.haskell.org/ghc/  :? for help
    λ> let ~[a,b] = [1,2]


    <interactive>:1:5: warning: [-Wincomplete-uni-patterns]
        Pattern match(es) are non-exhaustive
        In a pattern binding:
            Patterns of type ‘[a]’ not matched:
                []
                [_]
                (_:_:_:_)
    λ> 

-- 
    Viktor.


More information about the Haskell-Cafe mailing list