|
|
|
# Infix Type Constructors
|
|
|
|
|
|
|
|
## Brief Explanation
|
|
|
|
|
|
|
|
|
|
|
|
GHC allows type constructors to be infix operators (conops, beginning with `:`, but not including `:` itself).
|
|
|
|
|
|
|
|
|
|
|
|
Changes to the syntax may depend on whether [CompositionAsDot](composition-as-dot) is adopted, but roughly speaking we add
|
|
|
|
|
|
|
|
```wiki
|
|
|
|
qtycon -> qconid | ( qconsym )
|
|
|
|
qtyconop -> qconsym | ` qconid `
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
And `type` gets an extra production:
|
|
|
|
|
|
|
|
```wiki
|
|
|
|
type -> btype qtyconop type
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
(modulo [FixityResolution](fixity-resolution)). Also, there are obvious changes to the grammar for `type`, `data`, and `newtype` declarations.
|
|
|
|
|
|
|
|
## References
|
|
|
|
|
|
|
|
- [ Infix type constructors, classes, and type variables](http://www.haskell.org/ghc/docs/latest/html/users_guide/type-extensions.html#infix-tycons) in the GHC User's Guide.
|
|
|
|
|
|
|
|
## Tickets
|
|
|
|
|
|
|
|
<table><tr><th>[\#78](https://gitlab.haskell.org//haskell/prime/issues/78)</th>
|
|
|
|
<td>Add infix type constructors</td></tr></table>
|
|
|
|
|
|
|
|
## Pros
|
|
|
|
|
|
|
|
- This is a straightforward generalisation, doesn't break any existing code, and improves the consistency of the syntax.
|
|
|
|
|
|
|
|
## Cons |
|
|
|
\ No newline at end of file |