| 45 | | == References == |
| 46 | | |
| 47 | | * [http://www.haskell.org/ghc/docs/latest/html/users_guide/type-extensions.html#infix-tycons Infix type constructors, classes, and type variables] in the GHC User's Guide. |
| 48 | | |
| 49 | | == Tickets == |
| 50 | | [[TicketQuery(description~=InfixTypeConstructors)]] |
| 51 | | |
| 52 | | == Pros == |
| 53 | | * This is a straightforward generalisation, doesn't break any existing code, and improves the consistency of the syntax. |
| 54 | | |
| 55 | | == Cons == |
| 56 | | |
| 57 | | * If operators are type constructors, they can't also be type variables. I know one place where people use a type variable that is an operator. Something like this. |
| | 42 | * You may say that it's inconsistent for `(+)` to range over type constructors, because at the value level you have to start data constructors with a ":". But the type level is already funny. The whole type-family idea (including H98 type synonyms) defines things that begin with a capital letter, but which (unlike data constructors) are not head normal forms. Looking further ahead, by the time we have full type-synonym families, they really are ''functions'' as much as any value-level function is. For example it would be silly to insist on a leading colon here: |
| | 71 | == References == |
| | 72 | |
| | 73 | * [http://www.haskell.org/ghc/docs/latest/html/users_guide/type-extensions.html#infix-tycons Infix type constructors, classes, and type variables] in the GHC User's Guide. |
| | 74 | |
| | 75 | == Tickets == |
| | 76 | [[TicketQuery(description~=InfixTypeConstructors)]] |
| | 77 | |
| | 78 | == Pros == |
| | 79 | * This is a straightforward generalisation, and doesn't break any existing code (except code that uses GHC extensions to have a type variable that is an operator). |
| | 80 | * It's very useful to write type expressions like `(a + b)`. |
| | 81 | |
| | 82 | == Cons == |
| | 83 | |
| | 84 | * If operators are type constructors, they can't also be type variables. I know one place where people use a type variable that is an operator. Something like this. |
| | 85 | {{{ |
| | 86 | data T (~>) = MkT (Int ~> Int) |
| | 87 | }}} |
| | 88 | We'd have to use a type variable in back-quotes instead. |
| | 89 | |
| | 90 | |