tonsky / FiraCode

Free monospaced font with programming ligatures
SIL Open Font License 1.1
76.09k stars 3.07k forks source link

Ligature request: ?=> for Scala 3 context functions #1132

Open djneades opened 3 years ago

djneades commented 3 years ago

It would be great to have a ligature for ?=>, which is used by Scala 3 (Dotty) to define context functions.

tonsky commented 3 years ago

Thanks! I’ll see what I can do

djneades commented 3 years ago

Thank you for considering the suggestion! I really appreciate all your work on Fira Code.

tonsky commented 3 years ago

Thank you for your generous donation 🙏

julian-a-avar-c commented 2 months ago

Dotty is now the default compiler.

sideeffffect commented 1 month ago

Indeed, Scala 3 code will benefit greatly from this ligature. Thank you :pray:

julian-a-avar-c commented 1 month ago

Current behavior,

image

Just for transparency, this is on VSCodium 1.89.1, font size 14.


Here are some examples:

type Executable[T] = ExecutionContext ?=> T
// ___________________________________^
def table(init: Table ?=> Unit) =
// ___________________^
  given t: Table = Table()
  init
  t

def row(init: Row ?=> Unit)(using t: Table) =
// _______________^
  given r: Row = Row()
  init
  t.add(r)

def cell(str: String)(using r: Row) =
  r.add(new Cell(str))

In Scala there is also a =>, but usually ?=> also has the keywords given and using around it, in fact A ?=> B expands to using A => B. For non-scala programmers, and in omitting a lot of details, it would mean something like "function from A to B; given a value of type A at compile time."


Here are more examples:

https://www.scala-lang.org/api/3.4.2/docs/docs/reference/contextual/context-functions.html