Cara is a programming language aiming to be pleasant to use and maintain while staying safe and dependable.
To put it shortly, Cara combines:
Elm and its safety, maintainability and friendliness
Haskell and its brevity and power (in moderation)
Kotlin and its familiarity and syntax sugar
INTERCAL and its... just kidding!
Here is an incomplete list of Cara's features:
- Compiled to automatically parallel native code via HVM...
- ...or interpreted (handy for scripting)
- Purely functional
- Familiar ALGOL-like syntax
- Statically typed with automatic type inference
- ADTs with exhaustive pattern matching
There is a large sampling of Cara programs in the end-to-end test suite.
type Maybe[a] = | Nothing | Just(a) traverse(fn: a -> Maybe[b], list: List[a]): Maybe[List[b]] traverse(fn,list) = go(list,) where go(,bs) = Just(List.reverse(bs)) go([a,...as],bs) = case fn(a) of Nothing -> Nothing Just(b) -> go(as,b++bs) xs = [1,2,3,4,5] ys = [6,7,8,9,10] f = \n -> if n == 3 then Nothing else Just(n) IO.println!(xs |> traverse(f)) // -> Nothing IO.println!(ys |> traverse(f)) // -> Just([6,7,8,9,10])
Right now the language tooling is very rough around the edges: if you want to try the language out, you'll need to
git clone the compiler repository.
You'll need Deno to run the compiler.
As of Q1 2023, I (1) am still largely trying to design how the language will look and behave rather than implementing it.
If you'd like to discuss it, feel free to open a GitHub issue or send me a message on Twitter or Mastodon. I do want to keep some creative freedom so I won't promise this will be "design by commitee" nor any kind of democracy, but I would be very happy to hear your opinions, experience and tales from the trenches! (1)
- "This will be impossible to parse because XYZ!"
If you instead want to contribute to the documentation (this website), feel free to head over to the website repo and make a PR or an issue!