sintrastes / hafly Goto Github PK
View Code? Open in Web Editor NEWDynamic embeddable scripting language in Haskell.
Home Page: https://sintrastes.github.io/hafly
License: GNU Affero General Public License v3.0
Dynamic embeddable scripting language in Haskell.
Home Page: https://sintrastes.github.io/hafly
License: GNU Affero General Public License v3.0
Currently these have to be specified one-by one, e.x. a forEach
for IO
, a forEach
for List
, etc...
It would be really nice if we could specify these polymorphically somehow. I'm not entirely sure how that would work.
Currently, we have:
> [1,2,3,4.2]
[<<Int>>,<<Int>>,<<Int>>,<<Double>>]
whereas it would be nice if we had:
> [1, 2, 3, 4.2]
[1, 2, 3, 4.2]
Maybe the best approach for this would be to have the interpreter see if there is a show
instance for each element of the list, and try to display it that way -- otherwise, falling-back to just displaying the type?
We'll need some way to disambiguate these from function calls, maybe something like:
For an expression x.y
:
x
is a record, first check to see if it has any fields y
. If so, use y
as a record accessor for that field.y
that could act on x
.e.x. [1, 2, 3].map \x -> x + 2
The reason for this is likely that .
is not defined to use flexible application.
This would allow us to do things like define /=
in terms of ==
.
To be fully general, we should also allow expressions to depend on operators, and operators to depend on expressions.
Currently, examples such as foldr (\x y -> x + y) 0 [1,2,3,4,5]
do not evaluate properly.
I believe this has to do with lambdas always having type Dynamic -> Dynamic
.
Currently, currying seems to be causing issues, e.x.
f = \x y -> x
g = f 2
> g 3
3 -- (expected 2)
e.x. if I start typing:
main = {
I want the next line of the interpreter to be indented by four spaces.
In order to properly act on Dynamic
data with higher-order functions, we'll probably need to consider variance (e.x. implicitly lifting a [Int]
to a [Dynamic]
. We want this to be able to be specified for an arbitrary Haskell data type to keep things extensible.
This may also be relevant for features like functor/applicative/monad polymorphism. e.x. if f : Int -> Int
and x: [Int]
, we could say f x
, and have that automatically lifted to map f x
. This I think is the general idea behind what I was thinking of as "reactive polymorphism".
Currently multiple dispatch only works on library-defined functions.
I believe one reason for this is that the user currently has no way of being able to specify type signatures.
We should probably make our type signatures mirror that of Haskell's.
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.