Will
Will

Reputation: 433

Haskell for the .NET platform?

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 implementations in the same vein as IronPython?

Upvotes: 43

Views: 11055

Answers (4)

redtuna
redtuna

Reputation: 4600

There is no .net Haskell that I know of, but another functional language is available: 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#.

Upvotes: 4

Don Stewart
Don Stewart

Reputation: 137947

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.

One of the core differences is, that Haskell is always lazy, while OCaml and F# evaluate mostly strict, and lazy just in some special cases.

There are many similarities besides that. All three do focus on referential transparency by default, and have very good type inference, as an example.

Upvotes: 34

Contango
Contango

Reputation: 80192

See hs-dotnet: Pragmatic .NET interop for Haskell

hs-dotnet is a pragmatic .NET interop layer for Haskell. It exposes both .NET classes to Haskell (via GHC) and Haskell function values to .NET.

Upvotes: 16

Rei Miyasaka
Rei Miyasaka

Reputation: 7096

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.

Upvotes: 11

Related Questions