-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
5 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
tokens: | ||
|
||
[TokenType,TokenLiteral "Id",TokenEq,TokenOB,TokenLiteral "String",TokenArrow,TokenLiteral "String",TokenCB,TokenAmpersand,TokenOB,TokenLiteral "Int",TokenArrow,TokenLiteral "Int",TokenCB,TokenAmpersand,TokenOB,TokenLiteral "Bool",TokenArrow,TokenLiteral "Bool",TokenCB,TokenIn,TokenLet,TokenLiteral "id",TokenEq,TokenOB,TokenLiteral "x",TokenColon,TokenLiteral "String",TokenPipe,TokenLiteral "Int",TokenPipe,TokenLiteral "Bool",TokenCB,TokenFatArrow,TokenLiteral "x",TokenIn,TokenLet,TokenLiteral "_",TokenEq,TokenLiteral "id",TokenQuote,TokenString "hello world",TokenQuote,TokenIn,TokenLet,TokenLiteral "_",TokenEq,TokenLiteral "id",TokenBool True,TokenIn,TokenLiteral "id",TokenInt 1] | ||
[TokenType,TokenLiteral "Id",TokenEq,TokenOB,TokenLiteral "String",TokenArrow,TokenLiteral "String",TokenCB,TokenAmpersand,TokenOB,TokenLiteral "Int",TokenArrow,TokenLiteral "Int",TokenCB,TokenAmpersand,TokenOB,TokenLiteral "Bool",TokenArrow,TokenLiteral "Bool",TokenCB,TokenIn,TokenLet,TokenLiteral "id",TokenColon,TokenLiteral "Id",TokenEq,TokenOB,TokenLiteral "x",TokenColon,TokenLiteral "String",TokenPipe,TokenLiteral "Bool",TokenPipe,TokenLiteral "Int",TokenCB,TokenFatArrow,TokenLiteral "x",TokenIn,TokenLet,TokenLiteral "_",TokenEq,TokenLiteral "id",TokenQuote,TokenString "hello world",TokenQuote,TokenIn,TokenLet,TokenLiteral "_",TokenEq,TokenLiteral "id",TokenBool True,TokenIn,TokenLiteral "id",TokenInt 1] | ||
|
||
ast: | ||
|
||
STypeAlias "Id" (STypeIntersection (STypeFunc (SType "String") (SType "String")) (STypeIntersection (STypeFunc (SType "Int") (SType "Int")) (STypeFunc (SType "Bool") (SType "Bool")))) (SLetInfer "id" (SDefInfer "x" (STypeUnion (SType "String") (STypeUnion (SType "Int") (SType "Bool"))) (SName "x")) (SLetInfer "_" (SApp (SName "id") (SString "hello world")) (SLetInfer "_" (SApp (SName "id") (SBool True)) (SApp (SName "id") (SInt 1))))) | ||
STypeAlias "Id" (STypeIntersection (STypeFunc (SType "String") (SType "String")) (STypeIntersection (STypeFunc (SType "Int") (SType "Int")) (STypeFunc (SType "Bool") (SType "Bool")))) (SLet "id" (SType "Id") (SDefInfer "x" (STypeUnion (SType "String") (STypeUnion (SType "Bool") (SType "Int"))) (SName "x")) (SLetInfer "_" (SApp (SName "id") (SString "hello world")) (SLetInfer "_" (SApp (SName "id") (SBool True)) (SApp (SName "id") (SInt 1))))) | ||
|
||
type: | ||
check err: | ||
|
||
TUnion TString (TUnion TInt TBool) | ||
"Var<id> of type <TIntersection (TFunction TString TString) (TIntersection (TFunction TInt TInt) (TFunction TBool TBool))> trying to be assigned with <TFunction (TUnion TString (TUnion TBool TInt)) (TUnion TString (TUnion TBool TInt))>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
type Id = (String -> String) & (Int -> Int) & (Bool -> Bool) in | ||
let id = (x: String | Int | Bool) => x in | ||
let id: Id = (x: String | Int | Bool) => x in | ||
let _ = id "hello world" in | ||
let _ = id True in | ||
id 1 |