Skip to content
This repository has been archived by the owner on Feb 10, 2023. It is now read-only.
/ steinerlang Public archive

lang I'm making for fun in purescript to learn more about type systems

License

Notifications You must be signed in to change notification settings

prescientmoon/steinerlang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Steiner

Lang I'm making for fun

How to run locally

You first need to have purescript and spago installed locally.

  1. Clone the repo
  2. Run spago run

This will start the steiner repl.

Note: the first time you try and run it will take a while since spago will have to install all the dependencies and stuff.

Commands in the repl

Command Description
:ast expr print the ast an expression parses to
:t expr Infer the type of an expression
:check (expr) type Check if an expression has a type
:s type type Check if a type is at least as polymorphic as another
:u type type See the result of unifying 2 types
:q Quit the repl
:clear Clear the console

Syntax

Comments

  1. single line

    -- something
  2. multi line

    {-
        Something
    -}

Types

  • Constants:

    Constants can start with any uppercase letter

    Int
    String
    Bool
    ...
  • Variables:

    Variables need to start with a lowercase letter

    something
    otherVar
    ...
  • Lambdas

    type -> type
  • Rank N Types

    forall name. type -- this can reference name

Expressions

  • Int literals

    0
  • float literals

    0.0
  • string literals

    "something"
  • If expressions

    if condition then expression else expression
  • Lambdas

    \a -> expression -- this can reference a
  • Type annotations

    expression :: type
  • Application

    function argument
  • Let expressions

    let name = expression in body -- this can reference name
  • Assumptions

    assume name :: type in expression -- this can reference name

About

lang I'm making for fun in purescript to learn more about type systems

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published