132 points · by AndreasFrom · 13y ago · 91 comments
Though BODOL mentions static typing, I didn't see any examples... What did I miss?
Why? Too limiting, syntax too cumbersome, transformers suck?
do
f <- openFile 'somefile.txt'
r <- read f
s <- doSomethingToR r
Kinda looked like every other language. Except no one else spoke it and the libraries (at the time) was of highly varying quality..Also, while I was comfortable with monads, I never got comfortable with monad transformers. I had one monad that was a stack of something like 4-5 monad transformers and I started to feel as though I was losing touch with the beauty of Haskell.
doSomethingToR <=< read <=< openFile
instead.Also, a 5 layer transformer stack is typically wrapped in a newtype, so it looks like an ordinary monad with the operations you need.
print sum(float(line) for line in open('somefile.txt'))Here's a reddit post I wrote about it a few months ago: http://www.reddit.com/r/programming/comments/14hhwa/program_...
Imperative code is much more intuitive in the small. That's why we lose when we make side-by-side code snippets of small toy programs and call it a case for FP. The 25-line imperative method is often more intuitive than the highly-dense 6-line functional one. The problem is that imperative code composes very poorly.
(IDENTIFICATION DIVISION.
(PROGRAM-ID. HELLO-WORLD.)
(PROCEDURE DIVISION.
((DISPLAY 'Hello, world'.)
(STOP RUN.))))Essentially, COBOL allows programmers to declare what their input file looks like and the compiler generates code that does all of the work of parsing the input and getting the data into the relevant variables.
Because COBOL comes from the (Big) Iron Age, this is all in terms of record-oriented files with fixed-width fields; a modern re-implementation of the concept would have to operate in terms of nested data structures (XML, JSON, sexps, etc.), which a Lisp-like's syntax is well-equipped to describe anyway.
If the features are good then I don't care about the name. I really like Rust (http://www.rust-lang.org/) although it sounds "rusty".
As for the name, if clojure was named anything that had the word "lisp" in it, like "foo lisp" or the like, it would have been dead already. Even racket had to get rid of the word "scheme" from their name for marketing reasons.
I studied computer science in the 80's. Maybe that there were some business ads of Lisp (especially Lisp machines). But I had the strong impression that Ada was much more hyped than Lisp. Where is Ada today?
> if it was features, then smalltalk would have won
It depends on how "features" is defined. C won over Lisp and Smalltalk because of the single feature of performance. At the time when C was invented hardware was very expensive.
> Even racket had to get rid of the word "scheme" from their name for marketing reasons.
Racket is a different language. Scheme (R6RS etc.) is a subset of that.
According to your logic Rust will have no chance at all. We will see.
The name made me chuckle.
The Hindley-Milner actually makes seeing where the type system comes in a little difficult with these examples.
Hopefully see more code soon.
I spent 2-4 weeks really trying hard to learn Haskell and I loved it. But when I tried to make something practical with it, I got so frustrated with its dependency manager (cabal) and its lack of support for Windows that I dropped it for Clojure.
I love Clojure's ecosystem, its ability to use any Java library, and its (lack of) syntax.
But I really miss the language features of Haskell. I think Clojure lets you get away with a lot of imperative style programming. You can have a function deep down in the bowels of your code perform side effects if you want. Haskell makes you define these in one place and forces you to separate it from the rest of your code (at least that's what the beginners books led me to believe).
A language that combines the benefits of both sounds like a dream.
My first project attempt was to write a web crawler that processed the data it downloaded. There seemed to be a library that was PERFECT for that named shpider: http://hackage.haskell.org/package/shpider
But, I couldn't install it because it depends on the curl library and the curl library depends on linux binaries. I develop on Windows. The people in the IRC channel kept on telling me the path of least resistance is to switch my OS. But I'm not willing to do that, especially if it's just for a practice project.
I was told I should be using http-conduit (or something) instead. But that was lower level than shpider so not ideal. I tried to install that and I got an error, too. Apparently the project owner had an incorrect config file and it was trying to use a version of the fault library that it was incompatible with (he fixed that the next day which was great. But the only reason I could have figured out my problem is with a team of people on IRC holding my hand through it). I can't blame Cabal for that, but for a complete newbie who has no idea what's going on, it's extremely intimidating.
Long story short, I tried installing ~10 libraries with Cabal and only one installed smoothly. All the others had me googling for obscure forum posts. Sometimes I could "trick" cabal into installing the library but when I'd use it I'd get a runtime error related to a bad install. I've never ever ever had a problem like this with leiningen. But again, I'm experienced with maven.
On top of that, Cabal seems to install everything in a global namespace which scares me. If your Project1 needs LibraryX version 1 and Project2 needs LibraryX version 2 and these versions are incompatible, what do you do? Use something like cabal-dev I was told. But I have no idea what I'm doing with Cabal as it is. If something goes wrong with an abstraction on top of it, I'm totally screwed when it comes to debugging my problem.
I think I get why Haskell did this. Time is precious and if you need something like Curl, your OS has Curl and you don't want to make it your business to rewrite Curl in Haskell, you'd just reuse the OS library. But if I use a different OS, you kind of screwed me.
I love the Haskell language and miss all its lovely features. But if the language requires me to change my OS to develop anything useful, that's a nonstarter.
All in all, no, its package system is no RubyGems or what-have-you, but I think the (IMO) language makes it worth it.
HN may hate me forever for saying this, but after using Haskell, I could never imagine switching to a LISP. There's too many thumbnail clippings involved, and not enough types ;-).
Perhaps you may want to give https://github.com/organizations/Frege a try. It's a bit more powerfull than Haskell 2010, through support for higher rank types. OTOH, due to lack of supporters, the libraries available are far from complete. But it compiles to Java, and so is interoperable with Java or any other JVM language.
There's a curl binary for Windows that uses cygwin. I had no problems developing Windows haskell apps based off curl FFI.
(from the README):
"occupation" =: "unemployed Haskell programmer"
"location" =: "mother's house"I don't understand how this is a reasonable objection when http://prgmr.com/xen/ and https://www.virtualbox.org/ exist.
> Shen is a splendid compromise, but I found myself wishing it came with Haskell's uncompromising purity and Standard ML's straightforward type system.
I guess Haskell/ML minded people have a reason to think this way, but I'd be more interested to know whether someone is doing anything interesting with Shen. Have you got any "production" code written in it and running to show off?
EDIT: sorry! ...fixed the gender bug.
This could also be a factor in the BODOL author's dismissal.
It's not like e.g. Python or Haskell have a fragmentation problem despite permissible licenses. Scheme has fragmentation problems but that seems to be a symptom of simple implementation and lack of a common set of libraries.
I think Shen is interesting, but if I used it I'd only be mining it for ideas to apply in other languages. It would make far more sense to me if he allowed derivatives iff they did not use the name.
She's pretty fast to dismiss Shen.
You could create a more functional version as long as it had a switch or default to the normal behavior and it was blessed by the powers that be (see comments on license), but you'd be "fighting the system" and all that.
I know it's a nitpick, but it seems strange to include characters that aren't on the keyboard as part of the default syntax.
> it seems strange to include characters that aren't on the keyboard as part of the default syntax
You say "not practical for anyone" and "seems strange", but maybe restricting a computer language to ASCII only is stange. With Pinyin IME's (e.g. Google's or Baidu's) people can easily and quickly enter thousands of characters not on the keyboard. It would be easy to someone to develop an IME to enable symbols to similarly be entered - (I mean a non-specific-IDE-based one, i.e. without having to go thru Eclipse or Emacs).
I find the parenthesis make me more aware of scope than other languages.
Also, avoiding to use nesting to introduce new identifiers goes a long way for clarity. I do hate "let" with a passion.
(define (naive-for start end my-body) (let ([operator (if (< start end) + -)]) (my-body) (cond [(not (eq? start end)) (naive-for (operator start 1) end my-body)])))
(naive-for 1 -2 (lambda () (displayln "For loop? Who needs those!")))
(define-syntax naive-for
(syntax-rules ()
[(naive-for start end body ...)
(let ([op (if (< start end) + -)])
(let loop ([s start] [e end])
(begin body ...)
(cond [(not (eq? s e))
(loop (op s 1) e)])))]))
(naive-for 1 -2
(displayln "Lambda? What lambda?"))Nitpicking aside, I fully approve of the goals and look forward to browsing the source.