Hacker News new | ask | show | jobs
by oscargrouch 4181 days ago
>First, GHC is not the same as requiring Java, since you don't need it to run the code

I think you dont read what i've wrote, or more likely, im explaining it poorly(not a native, sorry) . This can be a binary to compile and create source code, but also and often can be embedded to be used as a library.. im guessing you are using Windows because you've said you dont have a c compiler at hand.. but Windows are most a end-user thing, and end-users probably wont care about compiling code.. otherwise a c/c++ compiler is ubiquotous

Im not complaining about the tool, but about the use as a library, which is something this also aim to be, and C is a better aim at that because can be embedded in any language.. given the compiler is in haskel i cant access the AST for instance, i cant embed in my binary, but have to call another external binary instead.. but at least have a runtime to embed.. this may be ok for some.. but i was just saying that, despite the protocol language being very good, i couldnt use it instead of protobuf because i would have a more limited api and my end program/ goal would lose power and flexibility.

This is a pretty technical explanation, it could be coded in Brainf*ck.. nothing against the lang in itself.. is just that it limits the use case of this tool(as compared with protobuf)

2 comments

> end-users probably wont care about compiling code.. otherwise a c/c++ compiler is ubiquotous

ghc is pretty ubiquitous these days. Any serious linux distro will have a package so it's one line (apt-get install ghc or similar). Even on e.g. a mac it's no harder than installing ruby or python.

> given the compiler is in haskel i cant access the AST for instance, i cant embed in my binary, but have to call another external binary instead

You could write Haskell. It's a pretty nice language.

More to the point, Haskell does have a C FFI and allows you to build a library that exposes a C interface that C programs can link against. I don't know whether the authors have done that here, but the functionality is available.

No, I'm a long-time Linux user. I don't install G++ because I don't need it (I work in Haskell and Python) and I try not to install unnecessary packages or remove them when I'm finished. You do generally need gcc (or clang) in Linux, but not all distros distribute g++ in their gcc.

I don't think you really understand what GHC is. GHC can compile Haskell down to C or Assembly, and has an FFI to make Haskell embeddable in C. The runtime for GHC is not like the runtime for Java or other VM/Interpreter-based languages...Haskell can be compiled and embedded to turned into a shared library to be distributed with your code.