... | ... | @@ -39,7 +39,7 @@ We say that a set of conlikes is a **complete** match when a function which is d |
|
|
|
|
|
A user declares a complete match using a `COMPLETE` pragma. The definition consists of a list of conlikes.
|
|
|
|
|
|
```wiki
|
|
|
```
|
|
|
{-# COMPLETE con_1, ..., con_n #-}
|
|
|
```
|
|
|
|
... | ... | @@ -54,31 +54,16 @@ For a given `COMPLETE` pragma, for a complete matching `c`, if a user writes a f |
|
|
|
|
|
`COMPLETE` pragmas are always imported and exported from modules.
|
|
|
|
|
|
|
|
|
\# Examples
|
|
|
# Examples
|
|
|
|
|
|
|
|
|
The following examples should emit no warnings.
|
|
|
|
|
|
```wiki
|
|
|
pattern P :: A
|
|
|
pattern P = A
|
|
|
|
|
|
{-# COMPLETE P #-}
|
|
|
|
|
|
foo :: A -> A
|
|
|
foo P = A
|
|
|
```
|
|
|
patternP::ApatternP=A{-# COMPLETE P #-}foo::A->AfooP=A
|
|
|
```
|
|
|
|
|
|
```wiki
|
|
|
|
|
|
pattern N :: Maybe a
|
|
|
pattern N = Nothing
|
|
|
|
|
|
{-# COMPLETE N, Just #-}
|
|
|
|
|
|
qux :: Maybe a -> Bool
|
|
|
qux N = False
|
|
|
qux (Just 5) = True
|
|
|
|
|
|
```
|
|
|
patternN::Maybe a
|
|
|
patternN=Nothing{-# COMPLETE N, Just #-}qux::Maybe a ->BoolquxN=Falsequx(Just5)=True
|
|
|
``` |
|
|
\ No newline at end of file |