开发者

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


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.


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.


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.


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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜