ANNOUNCE: Salsa: A .NET Bridge for Haskell

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
18 messages Options
Reply | Threaded
Open this post in threaded view
|

ANNOUNCE: Salsa: A .NET Bridge for Haskell

Andrew Appleyard-2
I'd like to announce the first release of Salsa, an experimental Haskell
library that allows Haskell programs to access .NET libraries.

Here's a taste:

   > type Hello.hs
   import Foreign.Salsa
   import Bindings

   main = withCLR $ do
       _Console # _writeLine ("Hello .NET World!")

   > type Hello.imports
   System.Console: WriteLine

   > msbuild
   > .\hello
   Hello .NET World!

Salsa operates by loading the .NET runtime into your Haskell process and
using the FFI (and run-time code generation) to marshall calls between
the .NET and Haskell runtimes.  It includes a code generator and a
type-level library (which uses type families) to provide type-safe
access to .NET libraries in Haskell with C#-style method overload
resolution and implicit conversions.

The adventurous can find version 0.1.0.1 of Salsa on Hackage [1], the
darcs repository on code.haskell.org [2], and some (limited)
documentation on the Haskell wiki [3].

The library is experimental and by no means complete (refer to the wiki
page [3] for some of its limitations).  Be prepared to end up with
incomprehensible error messages and/or a broken compiler! :-)

At the moment you'll need Windows, GHC 6.8, and version 3.5 of the .NET
Framework to use it.

Have fun!

[1] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Salsa
[2] http://code.haskell.org/Salsa
[3] http://haskell.org/haskellwiki/Salsa

--
Andrew
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: ANNOUNCE: Salsa: A .NET Bridge for Haskell

Bugzilla from alfonso.acosta@gmail.com
Great! Are there any chances of getting support for non-Win32
platforms with Mono?

On Fri, Oct 10, 2008 at 2:12 PM, Andrew Appleyard
<[hidden email]> wrote:

> I'd like to announce the first release of Salsa, an experimental Haskell
> library that allows Haskell programs to access .NET libraries.
>
> Here's a taste:
>
>  > type Hello.hs
>  import Foreign.Salsa
>  import Bindings
>
>  main = withCLR $ do
>      _Console # _writeLine ("Hello .NET World!")
>
>  > type Hello.imports
>  System.Console: WriteLine
>
>  > msbuild
>  > .\hello
>  Hello .NET World!
>
> Salsa operates by loading the .NET runtime into your Haskell process and
> using the FFI (and run-time code generation) to marshall calls between the
> .NET and Haskell runtimes.  It includes a code generator and a type-level
> library (which uses type families) to provide type-safe access to .NET
> libraries in Haskell with C#-style method overload resolution and implicit
> conversions.
>
> The adventurous can find version 0.1.0.1 of Salsa on Hackage [1], the darcs
> repository on code.haskell.org [2], and some (limited) documentation on the
> Haskell wiki [3].
>
> The library is experimental and by no means complete (refer to the wiki page
> [3] for some of its limitations).  Be prepared to end up with
> incomprehensible error messages and/or a broken compiler! :-)
>
> At the moment you'll need Windows, GHC 6.8, and version 3.5 of the .NET
> Framework to use it.
>
> Have fun!
>
> [1] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Salsa
> [2] http://code.haskell.org/Salsa
> [3] http://haskell.org/haskellwiki/Salsa
>
> --
> Andrew
> _______________________________________________
> Haskell-Cafe mailing list
> [hidden email]
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: ANNOUNCE: Salsa: A .NET Bridge for Haskell

Don Stewart-2
In reply to this post by Andrew Appleyard-2
This could be a game changer.

Great work Andrew!!

-- Don

andrew.appleyard:

> I'd like to announce the first release of Salsa, an experimental Haskell
> library that allows Haskell programs to access .NET libraries.
>
> Here's a taste:
>
>   > type Hello.hs
>   import Foreign.Salsa
>   import Bindings
>
>   main = withCLR $ do
>       _Console # _writeLine ("Hello .NET World!")
>
>   > type Hello.imports
>   System.Console: WriteLine
>
>   > msbuild
>   > .\hello
>   Hello .NET World!
>
> Salsa operates by loading the .NET runtime into your Haskell process and
> using the FFI (and run-time code generation) to marshall calls between
> the .NET and Haskell runtimes.  It includes a code generator and a
> type-level library (which uses type families) to provide type-safe
> access to .NET libraries in Haskell with C#-style method overload
> resolution and implicit conversions.
>
> The adventurous can find version 0.1.0.1 of Salsa on Hackage [1], the
> darcs repository on code.haskell.org [2], and some (limited)
> documentation on the Haskell wiki [3].
>
> The library is experimental and by no means complete (refer to the wiki
> page [3] for some of its limitations).  Be prepared to end up with
> incomprehensible error messages and/or a broken compiler! :-)
>
> At the moment you'll need Windows, GHC 6.8, and version 3.5 of the .NET
> Framework to use it.
>
> Have fun!
>
> [1] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Salsa
> [2] http://code.haskell.org/Salsa
> [3] http://haskell.org/haskellwiki/Salsa
>
> --
> Andrew
> _______________________________________________
> Haskell-Cafe mailing list
> [hidden email]
> http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: [Haskell] Re: ANNOUNCE: Salsa: A .NET Bridge for Haskell

Niklas Broberg
> This could be a game changer.
>
>  Great work Andrew!!

Totally agreed, on both accounts. Really interesting to see.

>  -- Don

What, no Arch Linux port? :-)

Cheers,

/Niklas
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: ANNOUNCE: Salsa: A .NET Bridge for Haskell

Andrew Coppin
In reply to this post by Don Stewart-2
Don Stewart wrote:
> This could be a game changer.
>  

In what way? As far as I'm aware, .NET never really caught on and has
long since become obsolete. Or do you just mean the type system
machinery that has been developed could be used for other projects?

> Great work Andrew!!
>  

Yes indeed. I'm looking at the thesis now. It looks rather interesting...

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: ANNOUNCE: Salsa: A .NET Bridge for Haskell

John Van Enk
> .NET never really caught on and has long since become obsolete.

Oh, if only this was the case. :( You wouldn't believe the things I have to make .NET run on (but I can't talk about it... yay for NDAs).

/jve


On Fri, Oct 10, 2008 at 3:48 PM, Andrew Coppin <[hidden email]> wrote:
Don Stewart wrote:
This could be a game changer.
 

In what way? As far as I'm aware, .NET never really caught on and has long since become obsolete. Or do you just mean the type system machinery that has been developed could be used for other projects?

Great work Andrew!!
 

Yes indeed. I'm looking at the thesis now. It looks rather interesting...


_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe


_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: ANNOUNCE: Salsa: A .NET Bridge for Haskell

Anton van Straaten
In reply to this post by Andrew Coppin
Andrew Coppin wrote:
> Don Stewart wrote:
>> This could be a game changer.
>>  
>
> In what way? As far as I'm aware, .NET never really caught on and has
> long since become obsolete.

Wha?  Microsoft's programming languages all now depend on and compile to
.NET runtime (the CLR), including C#, Managed C++, Visual BASIC, and
even things like the Haskell competitor F#.  Hence Don's comment.

I've heard people at more than one company say that if they could access
.NET well from Haskell, they wouldn't be as interested in F#.

Anton

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: ANNOUNCE: Salsa: A .NET Bridge for Haskell

Andrew Coppin
Anton van Straaten wrote:
> I've heard people at more than one company say that if they could
> access .NET well from Haskell, they wouldn't be as interested in F#.

Mmm, I could see how that would work... ;-)

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: ANNOUNCE: Salsa: A .NET Bridge for Haskell

Brandon S Allbery KF8NH
In reply to this post by Andrew Coppin
On 2008 Oct 10, at 15:48, Andrew Coppin wrote:
> Don Stewart wrote:
>> This could be a game changer.
>
> In what way? As far as I'm aware, .NET never really caught on and  
> has long since become

News to me; lots of people installing VS.NET on campus...

--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [hidden email]
system administrator [openafs,heimdal,too many hats] [hidden email]
electrical and computer engineering, carnegie mellon university    KF8NH


_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: ANNOUNCE: Salsa: A .NET Bridge for Haskell

Jason Dagit-2
In reply to this post by Andrew Appleyard-2


On Fri, Oct 10, 2008 at 5:12 AM, Andrew Appleyard <[hidden email]> wrote:
I'd like to announce the first release of Salsa, an experimental Haskell
library that allows Haskell programs to access .NET libraries.

Wow, that's really great.  I have a .NET friendly employer, so I'm happy to see a tool/library that 'bridges" the gap between my dream of using Haskell on the job and my reality of using .NET on the job.

Thank you for releasing this!

Salsa operates by loading the .NET runtime into your Haskell process and using the FFI (and run-time code generation) to marshall calls between the .NET and Haskell runtimes.  It includes a code generator and a type-level library (which uses type families) to provide type-safe access to .NET libraries in Haskell with C#-style method overload resolution and implicit conversions.

That's a very pragmatic approach.  Nice.  But, as I understand it the Haskell you write still lives in Haskell-land and the .NET code you interface with lives in .NET land.  So this means, that if we tried this approach with other languagse, say Python and Java, our Haskell code would be a second class citizen there.  For example, suppose you embed CPython into an application and then build a Haskell <--> Python bridge.  Then my Haskell code I write must be recompiled for each platform and loaded by the python?  Similarly for Java, I'm assuming that while the JVM bytecode might get loaded by the security module my Haskell is living in Haskell-land and the JVM can't provide the users with the same guarantees.

So, what about translators?  I was thinking, maybe a nice way to interoperate would to translate Haskell to language du jour?  What if I could type, ghc --make Foo.hs -TPython, and I get Foo.py that can be run in the CPython implementation as just plain python?

My understanding is that changing GHC backend is a lot of work.  Take projects like lambdaVM, which I don't think has ever been completed, and you see that it involves writing a language specific run-time and some other work.  There is yhccore, which has a translator for javascript.  What is the way to go here?  I like GHC in terms of performance, robustness and language extensions.  Would I lose that with custom backends?  I imagine the language extensions I'd get to keep and everything else would be subject to how well the backend is written.

What do others think?
 
Thanks!
Jason


_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: ANNOUNCE: Salsa: A .NET Bridge for Haskell

Andrew Appleyard-2
In reply to this post by Bugzilla from alfonso.acosta@gmail.com
Alfonso Acosta wrote:
> Great! Are there any chances of getting support for non-Win32
> platforms with Mono?

Yep, I believe it's possible.

The interoperability layer is centered around two .NET methods:

  - Marshal.GetDelegateForFunctionPointer and
  - Marshal.GetFunctionPointerForDelegate

As long as Mono correctly implements these methods (I haven't tested
them, but Mono appears to implement them), it shouldn't be too difficult
to get Salsa going.  Most of the work involves extending the runtime
hosting code to use the Mono API to load the Mono runtime and then load
the driver assembly.  Everything after that point is relatively platform
independent.

It'd be worth implementing this just to see how long it takes Don to get
an Arch Linux port out for it... :-)

Regards,
Andrew
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: ANNOUNCE: Salsa: A .NET Bridge for Haskell

Andrew Appleyard-2
In reply to this post by Jason Dagit-2
Jason Dagit wrote:
> Thank you for releasing this!

No worries.  I might never have got around to releasing it if it wasn't
for the encouragement of Manuel Chakravarty, Don Stewart, and others.
Thanks guys!

> [...] as I understand it the Haskell you write still lives in
> Haskell-land and the .NET code you interface with lives in .NET land.

Yep, that's correct.  Compiling Haskell to .NET IL is a significantly
more adventurous project!  I wouldn't have managed to acheive a
practical result in the time I had for my thesis if I had taken that route.

Salsa's approach to type system mapping could be useful in such a
project though.

Regards,
Andrew
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: ANNOUNCE: Salsa: A .NET Bridge for Haskell

Alex Queiroz-2
In reply to this post by Andrew Coppin
Hallo,

On Fri, Oct 10, 2008 at 5:48 PM, Andrew Coppin
<[hidden email]> wrote:
> Don Stewart wrote:
>>
>> This could be a game changer.
>>
>
> In what way? As far as I'm aware, .NET never really caught on and has long
> since become obsolete. Or do you just mean the type system machinery that
> has been developed could be used for other projects?
>

     In what alternate universe?

--
-alex
http://www.ventonegro.org/
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: ANNOUNCE: Salsa: A .NET Bridge for Haskell

Albert Y. C. Lai
Alex Queiroz wrote:
> On Fri, Oct 10, 2008 at 5:48 PM, Andrew Coppin
>> In what way? As far as I'm aware, .NET never really caught on and has long
>> since become obsolete.
>
>      In what alternate universe?

Anthropic Principle: Everyone is in a different bubble of observable
reality.
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: ANNOUNCE: Salsa: A .NET Bridge for Haskell

Andrew Coppin
In reply to this post by Alex Queiroz-2
Alex Queiroz wrote:

> Hallo,
>
> On Fri, Oct 10, 2008 at 5:48 PM, Andrew Coppin
> <[hidden email]> wrote:
>  
>>
>> In what way? As far as I'm aware, .NET never really caught on and has long
>> since become obsolete. Or do you just mean the type system machinery that
>> has been developed could be used for other projects?
>>
>>    
>
>      In what alternate universe?
>  

One with a 3-day time dilation, apparently...



[Sorry, couldn't resist. ;-) ]

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: ANNOUNCE: Salsa: A .NET Bridge for Haskell

Creighton Hogg-4
In reply to this post by Albert Y. C. Lai
On Mon, Oct 13, 2008 at 1:35 PM, Albert Y. C. Lai <[hidden email]> wrote:

> Alex Queiroz wrote:
>>
>> On Fri, Oct 10, 2008 at 5:48 PM, Andrew Coppin
>>>
>>> In what way? As far as I'm aware, .NET never really caught on and has
>>> long
>>> since become obsolete.
>>
>>     In what alternate universe?
>
> Anthropic Principle: Everyone is in a different bubble of observable
> reality.

Dude!
Invoking the Anthropic Principle is the Physics equivalent of calling
someone a Nazi:  you automatically lose the discussion.
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: ANNOUNCE: Salsa: A .NET Bridge for Haskell

Alex Queiroz-2
In reply to this post by Andrew Coppin
Hallo,

Andrew Coppin wrote:

>>
>>      In what alternate universe?
>>  
>
> One with a 3-day time dilation, apparently...
>
>
>
> [Sorry, couldn't resist. ;-) ]
>

     No problem, I didn't get your point anyway.

-alex
http://www.ventonegro.org/
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: ANNOUNCE: Salsa: A .NET Bridge for Haskell

Manuel M T Chakravarty
In reply to this post by Andrew Appleyard-2
Great!  Thanks for putting the code out!

Manuel

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe