Search code examples
programming-languageshaskellfunctional-programmingocaml

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 Haskell 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.


Solution

  • 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.