There are a couple terrible examples. Bidirectional pattern synonyms must be valid as both expressions and pattern matches, or you get a compile error
My example was using unidirectional pattern synonyms. They allow any pattern match whatsoever as the body; the expression restriction is dropped because they aren't allowed to be used in expression contexts. They are defined using <- instead of =.
pattern MinView x m <- (minView -> Just (x, m))
That's functionally the same as the :< example above, but possibly a bit simpler to read, because the precedence of the symbols is more obvious. It defines a pattern synonym named MinView that is translated to the view pattern in parens.
It's quite possible you were conflating view pattern syntax with pattern guard syntax as the source of your confusion.
The PatternSynonyms extension enables two new top-level declarations, both declared with "pattern".
That's the easier syntax of a bidirectional pattern synonym. They can be used both as patterns and as expressions. There are a couple terrible examples. Bidirectional pattern synonyms must be valid as both expressions and pattern matches, or you get a compile errorMy example was using unidirectional pattern synonyms. They allow any pattern match whatsoever as the body; the expression restriction is dropped because they aren't allowed to be used in expression contexts. They are defined using <- instead of =.
That's functionally the same as the :< example above, but possibly a bit simpler to read, because the precedence of the symbols is more obvious. It defines a pattern synonym named MinView that is translated to the view pattern in parens.It's quite possible you were conflating view pattern syntax with pattern guard syntax as the source of your confusion.