Skip to content

dancewithheart/intellij-unison

Repository files navigation

IntelliJ IDEA Plugin for Unison

Scala CI

WIP

This is very early stages of the work.

No artifact is published.

Some key features are under development: e.g. abilities, non-trivial expressions.

See issue #22 for unsupported features & problems.

Playing with Unison samples

There are Unison snippets in ./src/test/testData you can run play around with them (see offical docs for hello world in Unison):

ucm
project.create samples
load Hello.u
update
run hello

Supported features

namespace models.User
use List +: :+
-- comments https://www.unison-lang.org/docs/language-reference/comments/
{-
https://www.unison-lang.org/docs/language-reference/term-declarations/

name : Type
name p_1 p_2 … p_n = expression
-}
x = 1
str = "hello"
xs = [1, 2, 3]
z = 2 Nat.+ 2
structural type Optional a = Some a | None
go1 : Boolean
go1 = true
db : Bytes
db = 0xsdeadbeef
c1 : Char
c1 = ?H
f2 : Float
f2 = -99.0
minInt : Int
minInt = -9223372036854775808
maxInt = +9223372036854775807
pie : Text
pie = "Apple pie"

hi : Text
hi = "Hello, \"world\"!"
boolFun : [Boolean]
boolFun = [true, false]

natId : Nat -> Nat
natId x = x
multi2 : Text
multi2 =
  """
    This is a
    multiline text
  """
t2 : (Int, Text, Boolean)
t2 = (-4, "Yes", false)
isEven num =
if mod num 2 === 0 then "even" else "odd"
zs = match 2 Nat.+ 2 with
  4 -> "Matches"
  _ -> "Doesn't match"
matchNum1 : Nat -> Text
matchNum1 num = match num with
  one | one === 1 -> "one"
  three | three === 3 -> "three"
  _ -> "no match"
matchExpression : Nat
matchExpression = match 1 Nat.+ 1 with
x@4 -> x Nat.* 2
y@2 -> y Nat.+ 1
_   -> 22
n2 = cases
n
| n < 10    -> "single digit"
| otherwise -> "other"
structural type Optional a = Some a | None
id1 : forall t. t -> t
id1 x = x

Contributions

Help welcome :)

About

Unison plugin for IntelliJ IDEA

Topics

Resources

License

Stars

Watchers

Forks

Contributors