Skip to content

Should we support prefix lollipop?

The linear types proposal does not define the linear arrow %1-> or in the prefix form.

Should we support it as (⊸)? Users tend to expect it, by symmetry with (->). For example, instance Monad ((⊸) r).

There are three options:

  1. Do nothing, expect users to use FUN 'One.
  2. Add a type synonym type (⊸) = FUN 'One. Drawback: it would have to be imported (you could use the infix form with only -XLinearTypes without importing any module but not the prefix form).
  3. Add a special, built-in, lollipop arrow (⊸) parallel to (->). Problems:
  • It would be the first time a name is available only with -XUnicodeSyntax. (E.g. :i (⊸) would have no equivalent without -XUnicodeSyntax)
  • The special handling for (->) would have to be repeated.
    • :i Functor would probably have to show instance for either FUN 'One a or (⊸) a, depending on -fprint-unicode-syntax.
    • There is special code to give (->) negative fixity.
    • There is special code to display instances in :i (->).
    • There is special code to support instance Monad ((->) r) without -XTypeSynonymInstances and -XFlexibleInstances
    • Quoting in TH which currently gives ArrowT (this may not need to be replicated for the linear arrow, though)

None of those issues is insurmountable but there's extra complexity.

  1. We could do (3.) + add a non-unicode arrow (%1->) or something. This is really awkward, because this is not a valid identifier. The * kind was a bit like this: a special entry in the parser that needed a lot of special handling, and we spent a lot of time getting rid of it.

My preferences are 1 > 2 > 3 > 4. I think deciding this is minor enough not to deserve a full-blown proposal.

Edited by Krzysztof Gogolewski
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information