开发者

Will Haskell be a good choice for my task?

I'm starting a new project and don't know which language to use.

My 'must have' requirements are:

  1. Be able to run on Windows/LinuxMacOs natively (native executable) – user should be able to just run the .exe (when on Windows, for example) and see the results.
  2. No runtimes/interpreters (no JVM, CLR etc.) – one file download should be enough to run the application.
  3. Full Unicode support.
  4. Be able to manipulate OS threads (create them, run multiple tasks in parallel on multi-core CPUs, etc.)
  5. Be reasonably fast (Python level performance and better).
  6. To have some kind of standard library that does low-level, mundane tasks.
  7. Not very niche and have some community behind it to be able to ask questions.

My 'nice to have' requirements are:

  1. Language should be functional.
  2. It should have good string manipulation capabilities (not necessarily regex).
  3. Not extremely hard to learn.

I'm thinking about H开发者_JS百科askell now, but keeping in mind OCaml as well.

Update: This application is intended to be a simple language parsing and manipulation utility.

Please advice, if my choice is correct.


Haskell:

1: It runs on Linux, Windows and OS X, in many cases without changes to source code.

2: Native binaries generated. No VM.

3: Full Unicode support. All UTF variants supported.

4: Full threading support, plus if you only want parallelisation then you can use "par" with a 100% guarantee that it only affects the time taken rather than the semantics.

5: As fast as C, although some tweaking can be required, the skills required are currently rather obscure, and apparently minor tweaks can have multiple orders of magnitude impact.

6: Standard library included, and "Hackage" has lots more packages including a range of parser libraries.

7: Friendly community on IRC (#haskell) and here.

Edit: On the "nice to have" points:

1: Haskell is an uncompromisingly pure functional language.

2: It has generally good string manipulation, with regexes if you want them. As someone said in a later comment, beware the efficiency of the built-in "String" type (it represents a string as a linked list of characters), but the ByteString and Text libraries will solve that for you.

3: Is it hard to learn? Its nowhere near as complicated as C++, and probably a lot simpler than Java or even maybe Python. But its pure functional nature means that it is very different to imperative languages. The problem is not so much learning Haskell as unlearning imperative thought patterns.


Haskell sounds like it fits the bill perfectly. GHC produces native code on OS X, linux and windows just fine, and in general has performance that is much better than Python (for many things, not everything).

The only strange request is the need for OS threads. Programs produced by GHC use lightweight threads, which perform much better than OS threads, and much easier to work with than pthreads.

Haskell is also excellent for language parsing, using libraries like Parsec.

We're also quite well known for how string and helpful the community is around Haskell.


To your third nice to have: Have a look at Real World Haskell, it's free and a very good introduction, including an introduction to all the points you need. (Such as parallel computing, string parsing, etc).


Maybe 'nice to have':

  1. yes pure functional and lazy evaluation.
  2. yes (as said before).
  3. depends on you, I think it's hard to learn, but gives you some great benefits.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜