Hacker News new | more | comments | ask | show | jobs | submit login
Ela, dynamic functional language (elalang.net)
45 points by T-A on May 16, 2015 | hide | past | web | favorite | 18 comments

The language proudly boasts on its home page that its `head` function has the same wart as Haskell's (i.e., not handling empty lists)? Combining this with an explicit use of the `Option` monad just seems like teasing.

(EDIT: Oops, I meant its "distinctive features" page http://elalang.net/About.aspx#features , under "Algebraic Types".)

(It's just my assumption that it doesn't handle empty lists, because it returns the literal first element of a non-empty one; but neither the Prelude http://elalang.net/docs/Article.aspx?p=lib\prelude.htm nor the list module http://elalang.net/docs/Article.aspx?p=lib\list.htm seems explicitly to mention the `head` function on lists (as opposed to strings or sequences) at all, so it's hard to say for sure.)

The "About" page that you linked has the code

    x = head xs //x is Some 1
which suggests 'head' is of type 'a -> Option a' and does not have the wart you are talking about.

The example is a bit misleading there. To be more clear using types there's

    xs :: [Maybe Int]
    head xs :: Maybe Int

Oh yeah, silly me!

As tel mentioned (https://news.ycombinator.com/item?id=9556393), this strange choice of list is why I said that combining `head` with an explicit (and, I think, misleading) use of the `Option` monad seemed like teasing.

You're right. I wasn't looking as carefully as you were. Sorry!

Reading about this language gives me such a strange feeling. It makes me think of the cargo cults who worship airplane tributes due to once an airplane landing and providing supplies.

Ela is clearly inspired by Haskell. It copies syntax and surface-level features mercilessly. It's also devoted to being dynamically typed which dramatically undermines the meaning and development of those very features.

It makes for an interesting experiment. I can't say whether or not a dynamic language of this design is easy to work in compared with others.

But I read things like Ela's "algebraic data types" and shudder a bit (and then a lot when I find the "Circle (& 'hello')" example). They're definitely inspired by ADTs, but also definitely nothing similar. These ADTs are that alien from MIB who steals human skin---on the surface you might confuse them, but a different sort of life boils underneath.

very similar to pure - http://purelang.bitbucket.org/ (not purescript).

What makes you think of Pure, as opposed to Haskell as mentioned on the page and by howling (https://news.ycombinator.com/item?id=9555980)? The influence of Haskell is clear, but it's not so obvious to me that this language uses term rewriting (as in Pure) in any fundamental way. Maybe I missed it?

Ela is a type safe, strictly typed language, which is, however, not burden by limitations of any particular type checker.

By nature, a language which is type safe and strictly typed must be burdened by the limitations of a "particular type checker." This is weak type safety at best. And it looks like there are runtime class checks, so you have all of the traditional drawbacks of dynamic languages.

In principle, the type checker could be pluggable. That would mean the language isn't burdened by the limitations of any particular type checker, although it would almost certainly be burdened by complications at the boundaries of where one type checker is used versus another. It also might be reasonable to insist that such a system represents a family of languages rather than a single one.

> Unlike many other languages, Ela doesn't make any trade-offs, trying to combine distinct programming paradigms that don't fit well together.

The author may want to tone down that claim - combining Haskell-style FP with dynamic typing certainly entails some trade-offs, regardless of whether or not they think it's a good idea.

From what I see it is pretty similar to Haskell besides some minor syntax differences, strict evaluation by default, and dynamic typing. So why should I use this over Haskell?

The typing variation feels like it's going to so strongly change the pragmatic use of this language that the best I could say is that it is very distantly inspired by Haskell.

Oh look, one of my pet hates. Displaying a sieve that claims to be the Sieve of Eratosthenes, and yet it does modulo tests, and hence isn't.

Edit: It was by chance that it happened to be the example in the "A taste of Ela" box at the top. Reloading the page makes the example change to something else, so if you are wondering what I'm talking about, reload the page until the "taste" box explicitly calls something the Sieve of Eratosthenes. It isn't.

For those not wanting to click reload a slew of times (it took me about 3 minutes of clicking!)...

    //Sieve of Eratosthenes
    primes xs = sieve xs
      where sieve [] = []
            sieve (p::xs) = 
              & p :: sieve [& x \\ x <- xs | x % p > 0]
    //Outputs: [2,3,5,7] 
    primes [2..10]

I guess that the Sieve of Eratosthenes is the algorithm implemented in http://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf ?

That paper does correctly deal with the issue. The conclusions in section 4 give an excellent summary.

Applications are open for YC Summer 2019

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact