Note [Builder for a bidirectional pattern synonym]
For a bidirectional pattern synonym, the function 'tcPatToExpr'
needs to produce an /expression/ that matches the supplied /pattern/,
given values for the arguments of the pattern synonym. For example:
pattern F x y = (Just x, [y])
The 'builder' for F looks like
$builderF x y = (Just x, [y])
We can't always do this:
* Some patterns aren't invertible; e.g. general view patterns
pattern F x = (f -> x)
as we don't have the ability to write down an expression that matches
the view pattern specified by an arbitrary view function `f`.
It is however sometimes possible to write down an inverse;
see Note [Invertible view patterns].
* The RHS pattern might bind more variables than the pattern
synonym, so again we can't invert it
pattern F x = (x,y)
* Ditto wildcards
pattern F x = (x,_) References 1
- Invertible view patterns GHC.Tc.TyCl.PatSyn
Referenced by 2
- Invertible view patterns GHC.Tc.TyCl.PatSyn
- GHC.Tc.TyCl.PatSyn call site