pietervdvn / lang Goto Github PK
View Code? Open in Web Editor NEWYet another programming language
Yet another programming language
The syntax [Just a:as]
is a syntax error now ([(Just a):as]
is ugly)
The :
means that the type on the left is a subclass from the type on the right. E.g. in type declarations (a:Eq)
, category decls: cat Map k v : Set k
.
For multiple subclassing, both "&" and "," should be possible: (a:Eq & Ord)
, (a:Eq, Ord)
;
cat Map k v : Set k, List b
, cat X a b: Monad a & List b
,
or &
. Also see #54Automatically add lensing to records.
(Haskell syntax)
Suppose we have a record
data Game = {
score :: Int,
player :: Entity
entities :: [Entity]
}
with Entity:
data Entity = {
name :: String
position :: Point
}
and Point:
data Point = {
x :: Int,
y :: Int
}
Each record would get automatic lensing. If you want the player entity to go up, you could write:
let game2 = game.player.position.y `modify` (+1)
or
(+=) = flip modify (+)
let game2 = game.player.position.y += 1
To do something for each element in a list, forEach would be a solution:
let game2 = game.entities `forEach` y *= 2
In some cases modify
could be left out with automatic function renaming:
let game2 = game.score `modify` (\x -> function x 3)
--equivalent to
let game2 = game.score `function=` 3
let game2 = game.score `modify` double
--equivalent to
let game2 = game.score double!
Maybe operations could be chained together with do by providing a correct Monad instance:
let game2 = do
game.player.position.y += 1
game.player.position.x -= 3
game.entities `update=` game
Something is broken with the local scope...
When a rule is declared twice, an error should be thrown
e.g.
empty : a -> Maybe x
f : a -> ...
empty =
Should empty be treated as deconstructor function or new variable name.
The type interference allows us to know what function we should take in implementation -> equivalent for haskells "module.function" syntax
What would be neat?
It's a bit dirty that the typechecker crashes on non-existant stuff
It's not meta info anymore
f : a -> a -> a
|(>=2) b = b
_ b = b
max : (a:Ord) -> a -> a
a |(<a) = a -- first arg= a; take this clause if second arg (<a)
_ b = b
Guards should work both for booleans and Maybe ()
f : { Int --> v } -> v
((lookup 0) v) = v
dict = ...
parse world module rule
should check if rule exists and is non-emptyImportant for stuff as:
(:) : b: >a => b -> [a] -> [b]
f : b : <a => a -> [a] -> [a]
Somehow, somewhere, the docstrings vanish!
e.g. ~~ (with name) or >> (without name). Code snippets written there should always evaluate to true.
In functions:
f : a in Ord; b is Eq => a -> a -> b -> b -> Bool
In ADT defs:
data _ BalancedTree (a is Ord) = Top content:a left:(BalancedTree a) right:(BalancedTree a)
| Nil
In class defs:
class Dict k v where:
lookup : k -> Dict k v -> v
class Ord a => SortedSet a where:
getMin : SortedSet a -> a
class SortedSet (a is Ord) where:
getMin : SortedSet a -> a
class SortedSet a where a is Ord:
getMin : SortedSet a -> a
Esp. {k --> {v}}
and {k --> [v]}
This should be a 'graph library'
What would be the best syntax for lists?
[a,b:as] = a + b + f as
[a:b:as] = a + b + f as
In combination with tuples
[(a,b):abs]
[a,b:c,d:abs]
a:as
[a:as]
[a,b:as]
[a:b:as]
[a,b] ++ as
In combination with tuples
[a,b:c,d:abs]
Fix in Semantal - Symboltable; remove the hardcoded fqnp
Caused by checkOne, as it makes function selection nondeterministic.
e.g.
f : a -> (b,c)
f : a -> (d,e,f)
What should we do in a deconstruct?
(f *)
With >>
Very few laws have good titles
Way neater syntax
f << g << h
(where << is left associative) merges to <<(f <<(g h))
instead of <<( <<(f g) h)
Test when everything is ready if this works.
Casts crash now;
"a b" matches strings as "ab"
e.g., so that localident can be written as
localIdent ::= "[a..z]" "[a..zA..Z0..9]"
Without having to worry that the parser can parse "a a" as a single localident
Neat extension to a?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.