11 ms·
Dogelang – A Python with Haskell Syntax
- rossdavidh 7y agoNice, but after it compiles to CPython bytecode, it really ought to transpile to Javascript.
- cyorir 7y agoPureScript already has the Haskell -> Javascript niche covered: https://en.wikipedia.org/wiki/PureScript https://en.wikipedia.org/wiki/PureScript
- ghostwriter 7y agoWhy using a separate language if GHCJS is already good enough?
- cyorir 7y agoAccording to the creator of PureScript: "Solutions at the time included various attempts to compile Haskell to JavaScript while preserving its semantics (Fay, Haste, GHCJS), but I was interested to see how successful I could be by approaching the problem from the other side - attempting to keep the semantics of JavaScript, while enjoying the syntax and type system of a language like Haskell." https://leanpub.com/purescript/read#leanpub-auto-about-the-author https://leanpub.com/purescript/read#leanpub-auto-about-the-a...
- ghostwriter 7y agoIt's a good reason for the author of the language, and for anyone who's interested in designing programming languages. However, I often wonder why people in the industry promote it as a great choice for developers who are looking for a "Haskell for frontend", instead of recommending GHCJS. I do understand why Elm is recommended instead of Haskell for simplicity reasons, but PureScript is neither simpler nor (presumably, if I'm not missing something) conceptually more valuable (i.e. bringing refreshingly new ideas) than GHC Haskell.
- wwright 7y agoPurescript does have algebraic effects and row polymorphism generally, which Haskell does not AFAIK (I don’t do as much Haskell as I would like so I may be wrong.)
- ghostwriter 7y agoAlgebraic effects are not part of the language implementation, but there are libraries like fused-effects[1] that implement them. Row polymorphism has been proposed a few years ago [2], but as with any community effort, the timeline and possibility of the actual implementation depends on the amount of attention put into it instead of some other (probably important, too) work. [1]: https://github.com/fused-effects/fused-effects https://github.com/fused-effects/fused-effects [2]: https://github.com/ghc-proposals/ghc-proposals/pull/180 https://github.com/ghc-proposals/ghc-proposals/pull/180
- ferzul 7y agoghcjs is kinda slow on my phone.
- misnome 7y agoOn a serious note, I've long wondered what python would feel like with haskell-style "whitespace" to call/partially call functions. It feels like it wouldn't be super difficult to get working; as far as I can think of "identifier ws identifier" is always currently a syntax error? Maybe a toy python project someday...
- TylerE 7y agoImplicit string concatenations are an edge case.
- eru 7y agoFun fact: you can make Haskell support implicit string concatenation, but it's a bit ugly and not advised. The route is via the OverloadedStrings extension, and then implementing an instance for IsString (String -> String) and IsString (String -> String -> String) etc.
- nestorD 7y ago> haskell-style "whitespace" to call/partially call functions That's called curryfication (named after the logician Haskell Curry) in case you don't already know :)
- DonaldPShimoda 7y ago> That's called curryfication I believe this is how it's called in non-English languages, but all my instructors and PL/semantics textbooks referred to this process as "currying" [0]. Which, if that's what you meant, is not what your parent comment was talking about. I believe they were talking just about syntax, not semantics, i.e., they wish in Python you could do `foo x y` instead of `foo(x, y)`. [0] https://en.wikipedia.org/wiki/Currying https://en.wikipedia.org/wiki/Currying
- gmfawcett 7y agoActually, that's a common misconception. If you're calling a function with a partial argument, it's called "partial application." If you're turning a multi-arg function into a single-arg function that returns another single-arg function, it's currying. Currying doesn't apply a function, it just transforms it. https://en.wikipedia.org/wiki/Currying#Contrast_with_partial_function_application https://en.wikipedia.org/wiki/Currying#Contrast_with_partial...
- makapuf 7y agoId much rather have python syntax and Haskell semantic to get good parts of both!
- piinbinary 7y agoI'm attempting to create something like that: http://www.ikkolang.com/ http://www.ikkolang.com/
- laughinghan 7y agoThis looks amazing!!! I am also working on a statically-typed language that aims to be fully inferred and have no type annotations, I will definitely be gleaning Ikko's design and your blog for insights.
- piinbinary 7y agoThanks! Feel free to reach out to me if you have questions
- fishmaster 7y agoI'll be following this
- anentropic 7y agoThat would be interesting! There is Hacket, which is Racket with Haskell semantics (Haskell in S-Expressions)... https://lexi-lambda.github.io/blog/2017/05/27/realizing-hackett-a-metaprogrammable-haskell/ https://lexi-lambda.github.io/blog/2017/05/27/realizing-hack...
- fishmaster 7y agoI thought I read that Hacket wasn't actively developed anymore?
- nineteen999 7y ago
- pizza 7y agoIs there a Python with Haskell syntax (or at least, much less verbose than regular Python..) that can have little a Haskell static typing, as a treat?
- qznc 7y agoNim maybe? https://nim-lang.org/ https://nim-lang.org/
- deleted 7y ago[deleted]
- cyorir 7y agoNothing comes to mind. Most attempts to introduce static typing into Python only do that, and not much more. Seq is an example: https://github.com/seq-lang/seq https://github.com/seq-lang/seq I think you might be interested in looking at multi-paradigm languages that use static/inferred typing and combine the functional and imperative paradigms. Some worth taking a look at might be OCaml, Nim, and F Sharp. Nim leans more towards Python, OCaml and F# lean more towards Haskell. https://en.wikipedia.org/wiki/OCaml https://en.wikipedia.org/wiki/OCaml https://en.wikipedia.org/wiki/Nim_(programming_language) https://en.wikipedia.org/wiki/Nim_(programming_language) https://en.wikipedia.org/wiki/F_Sharp_(programming_language) https://en.wikipedia.org/wiki/F_Sharp_(programming_language)
- mhh__ 7y agoIs that not Just ML? Hindley-Milner functional but much more pragmatic when it comes to stateful programming?
- smegma2 7y agoI've been wanting this for a while, mainly because I often find myself writing long function composition chains that end up being a mess of parentheses. Python is good at encouraging functional style but sometimes it ends up being too much to be readable with the normal syntax.
- dzsekijo 7y agoPython is as good at encouraging functional style as a massive arsenal of weapons of mass destruction is good at encouraging world peace.
- jefurii 7y agoHow about a Rust or a Go with Python syntax?
- steveklabnik 7y agohttps://github.com/mystor/slag https://github.com/mystor/slag (Won’t actually work today)
- jchook 7y agoReminds a bit of Clio lang [0]. Clio transpiles to JavaScript and appears to target microservices or serverless architecture. https://clio-lang.org/ https://clio-lang.org/
- yellowapple 7y agoAll the performance of Python with all of the readability of Haskell ;)
- ferzul 7y agowhat's <$> so unreadable <*> about haskell?
- wwright 7y agoThe learning curve is pretty intense, but I do want to say that the operators you use here are actually pretty great for readability after you learn them. I don’t know if that makes them worthwhile, but I always find them a breath of fresh air.
- eru 7y agoA lot of Haskell's more controversial constructs are about being able to hide plumbing. Applicative plumbing is especially easy in structure, so removing it from you doesn't hide any complexity from the experience programmer. It's easy to reconstruct the plumbing on the fly in your mind, if you want to reason about it. Other tools like lenses or arrows take a lot longer for a lot of people to internalize like that.
- mrkeen 7y agoabout(haskell).flatMap(a -> { return so(unreadable).map(s -> { return whats(s, a); }); });
- jhbadger 7y agoAnother language that is similar, but with more an ML syntax is MLite (https://www.t3x.org/mlite/index.html https://www.t3x.org/mlite/index.html). Like this, it's an interpreter with dynamic typing, and probably not that useful, but it is fun to play around with functional programming with.
- AzzieElbab 7y agosuper cool. if anything else it exposes haskellers sense of humor
- thedataangel 7y agoHaskell's syntax without Haskell's type system sounds like a nightmare. The type system is what makes me at least vaguely confident that the incomprehensible string of symbols that make up a good chunk of Haskell expressions are at least close to being correct. (And to be clear: I use Haskell professionally and love it - but the syntax is _not_ why most people use Haskell).
- laughinghan 7y agoDid the tagline "Slow. Stupid. Absolutely adorable." not clue you in that this is a joke?
- icedchai 7y agoThe name alone should be enough.
- manthideaal 7y agoWhy?, not a native English speaker, I looked up doge and it has no meaning, any tips for other meaning?
- DoreenMichele 7y agoIt's a meme: https://en.wikipedia.org/wiki/Doge_(meme) https://en.wikipedia.org/wiki/Doge_(meme)
- wyager 7y agoI can’t identify with this description (“incomprehensible string of symbols”) at all, unless maybe you’re talking about Lens-based code or something. I think most people who complain about the readability of a language like Haskell are confusing familiarity with clarity. We learned Java or C++ or whatever in school, and despite the fact that those objectively have more complex syntaxes and more meaningless symbols, they are “easier to read” because that’s what you started with. Haskell has a higher semantic density with fewer boilerplate symbols - surely easier to read from a first principles standpoint. If you started from a math background and are comfortable thinking in terms of equations, it’s almost certainly easier to read.
- krick 7y agoSo, the worst of two worlds? Nice. Dogelang indeed.
- whoisthemachine 7y agoFinally, I have found my language.
- bishalb 7y agoI wish they used the famous Doge meme image for the mascot.
- thanatropism 7y agoI'm a big fan/proponent of Hy (http://hylang.org http://hylang.org), a Lisp built onto Python. Even going to the somewhat irresponsible extent of using it in production!
- anonsivalley652 7y agoI'm not sure what's funnier: that it exists or that some people still haven't heard of Poe's law. Or did a sense of humor pervasively roll on its back, cross its arms and legs, and replace their eyes for X's?
- kbumsik 7y ago> A programming language that compiles to CPython bytecode, much like Scala compiles to JVM's. I'm wondering if the CPython bytescode is stable though. Is the Python bytecode spec managed independently from the language version (like JVM) so this kind of approach won't break when a new Python is released?