tags:

views:

253

answers:

4

I'm a .NET developer by day, but have been playing with Haskell in my spare time for awhile now. I'm curious: any Haskell .net implemenations in the same vein as IronPython?

+1  A: 

That's what F# is for.

Sam
derp (more text)
Brad Heller
I don't know either Haskell or F# well enough to compare, but in terms of functional languages on the .NET platform, I suspect that F# will corner the market simply because it's supported by Microsoft and included in Visual Studio (starting with 2010, but you can get plugins for previous versions of VS).
Thomas Owens
No, F# derives from OCaml which is a different story than Haskell which draws more from LISP.
Johannes Rudolph
@Johannes Rudolph: What? No, Haskell has very little in common with LISP, but is a (somewhat distant) cousin of the ML family. F# also draws a few bits of additional inspiration from Haskell, as does C# for that matter, and much of the work done on Haskell as a language is funded by Microsoft Research.
camccann
@camccan: I didn't want to overstate that LISP thing but it certainly has more in common with LISP than with OCaml. Correct me if me or http://en.wikipedia.org/wiki/Haskell_(programming_language) is wrong here.
Johannes Rudolph
@Johannes Rudolph: As far as I can see, the Wikipedia page only mentions LISP in the rather vague "influenced by" sidebar section, which still names more MLs than Lisps. Lisp and Haskell are nearly as unlike each other as two functional languages can be, and I could probably formulate a plausible argument that modern **C#** has more in common with Haskell than does Common Lisp, nevermind F#.
camccann
@Johannes: Through its static typing, type inference, and algebraic data types, Haskell is *much* more closely allied with Standard ML, Objective Caml, and F# than it is with any language in the Lisp family. And if you read something about programming languages on wikipedia, it is probably wrong---I don't know who writes this stuff, but I have given up trying to fix it. I'm not willing to shovel against the tide. The quality of information is much better on SO.
Norman Ramsey
@Norman: Thanks for enlightening me.
Johannes Rudolph
+2  A: 

There is no .net Haskell that I know of, but another functional language is avilable: F#. It runs in .Net and comes with Visual studio. They are similar to a point; this stackoverflow question explains the differences.

Here's the documentation on getting started with F#.

redtuna
Thanks. I've fiddled with both F# and OCaml, but prefer haskell.
Will
+10  A: 

There's no active work on porting the GHC runtime to .NET.

F# is the closest thing, though be aware it is based on OCaml, and as such, isn't based on referential transparency by-default, as Haskell is.

Don Stewart
Thank you, Don. Also, thanks for Real World Haskell.
Will
+5  A: 

Haskell wouldn't readily work very well on .NET without some big changes to the runtime or maybe a really clever compiler.

Maybe things will change when code contracts permeate more, but right now, even functions that actually are pure in behavior, like the string manipulation functions, would have to be accessed via IO -- so it just wouldn't be worth it at all.

That, and there are optimization issues -- .NET doesn't do any optimizations for immutable objects, for instance, so lists (sequences as they're called in F#, or IEnumerable as they're called in C#) wouldn't be as efficient.

A Haskell IL compiler might be doable, like something that spits out .NET assemblies instead of x86 .exes/.dlls.

Rei Miyasaka
@Rei Miyasaka: While this question is specifically about .NET, I'm curious whether the same arguments hold if Haskell were to run on the JVM. Does the JVM, for example, do any more optimizations on immutable objects than the CLR?
stakx
As far as I know, the situation is the same with immutability.I imagine optimizing immutability is pretty darn complicated, balancing memory and performance costs and such. The garbage collector would probably look different too, and JVM and .NET share similar garbage collectors.One thing that .NET 4 has is tail recursion optimization, which helps to simplify functional compilers -- but they only provided it for x64 and not for x86, which is a decision that baffles me beyond words.
Rei Miyasaka
@stakx: If you really want to know, I'm sure there's plenty of material on that subject from the people working on Scala and Clojure. If memory serves me, Clojure in particular places heavy emphasis on immutable data.
camccann
@Rei: TCO works on x86.
Jon Harrop