Valkyrie Tutorial

A multi-stage gradual typed language


Valkyrie is a experimental multi-stage gradual typed language, hoping to combine the respective advantages of static typing and dynamic typing.

Integrate functional programming and object-oriented programming paradigms, and explore new effect-based paradigms.

The grammar mainly borrows from scala and swift, But many runtime concepts come from rust.

In fact, you can think of it as scala implemented in rust.


  • Algebraic Data Types
    • Your favorite functional paradigm
    • Null-safe, languages under the ADT model are strictly null-safe
  • Algebraic subtyping
    • Restricted traditional object-oriented paradigm
  • Algebraic Effects (planned, semantically unclear)
  • Gradual Structure Typing
    • Intelligent automatic type inference (in progress)
  • AST Macros (in progress)
    • Multi-stage programming with package isolation (not yet implemented)
  • Concurrent Garbage Collection (in plan, use rc for now)
  • Lossless Rust FFI (in plan, waiting for crABI)

Tools & Community


Learn basic syntax first

Then learn how to combine FP and OOP

Then learn funky control flow

Finally, a never-ending journey of advancement

  • Pattern Match & Extractor
  • Constructor and Builder
  • Define Effect
  • Io effect and Logging effect
  • Generics, covariance, contravariance and invariance
  • Type conversion, type reinterpretation and type transmutation
  • Iterators and Generators
  • Closures, callbacks and asynchronous programming
  • Raw pointers and unsafe programming
  • Value types and the stack allocation
  • Macro and package isolation compile