holoed / juniornative Goto Github PK
View Code? Open in Web Editor NEWA Functional Language that compiles to JavaScript
License: Apache License 2.0
A Functional Language that compiles to JavaScript
License: Apache License 2.0
Add renamer after type checking
Transform this:
const anf_17 = applyClosure(__eqeq, getEnv("eqInt", _env));
const anf_20 = applyClosure(anf_17, getEnv("i", _env));
const anf_18 = applyClosure(fromInteger, getEnv("numInt", _env));
const anf_19 = 65;
const anf_21 = applyClosure(anf_18, anf_19);
const anf_22 = applyClosure(anf_20, anf_21);
into this:
const anf_19 = 65;
const anf_22 = getEnv("i", _env) == anf_19;
Bug repro
let add (z1, z2) =
let (a, b) = z1 in
let (c, d) = z2 in
(a + c, b + d)
let main = add ((2, 3), (4, 5))
src/compiler/ClosureConversion.hs:80:17-47: Non-exhaustive patterns in In (Ann _ (VarPat name))
val f :: (a -> b) -> Maybe (List a) -> Maybe (List b)
let f = fmap . fmap
should compile but it doesn't, it gives instead the error:
"Unable to unify List with Maybe"
Just like https://mail.haskell.org/pipermail/haskell-prime/2007-March/002137.html
data Tree a = Leaf | Node (Tree a) a (Tree a) deriving Functor
would generate the following Functor instance:
instance Functor Tree where
fmap f (Leaf ) = Leaf
fmap f (Node l a r) = Node (fmap f l) (f a) (fmap f r)
Example:
From
match a with
| S Z -> e1
| S x -> e2
| Z -> e3
to
match a with
| S a1 -> match a1 with
| Z -> e1
| a2 -> let x = a2 in e2
| Z -> e3
let fix f x = f (fix f) x
let cata psi f = psi . fmap f . fixOut
let cataRec psi = fix (cata psi)
let example = fixIn (Cons 5 (fixIn Empty))
let main = cataRec productAlg example
Introduce support for definition of custom types.
Example:
type Maybe a = Nothing | Just a
Example:
data Option a = None | Some a
let foo x = match x with
| Some x -> x
| None -> 0
should translate to:
data Option a = None | Some a
let foo x = if (isSome x) then (extractSome x)
else if (isNone x) then 0
else undefined
Inspired by Ocaml syntax:
https://v2.ocaml.org/manual/expr.html
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.