Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • P prime
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
    • Locked files
  • Issues 128
    • Issues 128
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Model experiments
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • HaskellHaskell
  • prime
  • Wiki
  • infix type constructors

infix type constructors · Changes

Page history
Edit InfixTypeConstructors authored Nov 24, 2010 by Iavor S. Diatchki's avatar Iavor S. Diatchki
Hide whitespace changes
Inline Side-by-side
infix-type-constructors.md
View page @ aac150bd
......@@ -96,6 +96,51 @@ And `type` gets an extra production:
data a `Bar` b = a `BAR` b
```
## Issues
The second proposal—-to treat all infix operators as type constructors—-leads to an ambiguity in import/export declarations:
```wiki
module Test ( (+) ) where
```
This export declaration is ambiguous because it is not clear if we mean to export the value operator (+), the type constructor (+), or both.
A similar issue arises with imports.
One possible solution is to state that, when written on their own, infix operators in import/export specifications refer to the value level.
So in the above example we would be exporting the value operator (+).
To import/export the type constructor one would have to use an explicit (possibly empty) sub-ordinate list:
```wiki
module Test ( (+)() ) where
```
Unfortunately, such specifications look rather odd.
Another solution would be to introduce a new piece of syntax which would translate to the same thing. Perhaps:
```wiki
module Test ( type (+) ) where
```
The intention here is that `type` specifies the namespace of the following name, and not that it is a type synonym.
## References
......
Clone repository
  • Arrows
  • BangPatterns
  • DeepSeq
  • ExistentialQuantification
  • ExplicitForall
  • FlexibleContexts
  • FlexibleInstances
  • ForeignFunctionInterface
  • FunctionalDependencies
  • GADTs
  • ImplicitParams
  • IncoherentInstances
  • KindAnnotations
  • LamdaCase
  • MultiParamTypeClasses dilemma
View All Pages