hs-dotnet: Pragmatic .NET interop for Haskell

[ .net, bsd3, library ] [ Propose Tags ]

hs-dotnet integrates the .NET platform with Haskell (via GHC.)

It lets you interact with .NET code and libraries, providing full access to .NET objects in a type-safe manner. This also includes parameterized .NET types (generic types), representing them in a manner natural to Haskell.

Dually, Haskell functions can be accessed and called from .NET, hs-dotnet transparently exposing these as delegates for you. Two example uses of this facility are the use of Haskell when programming LINQ and in Windows Forms UIs. Here's how to fire up an example program accessing LINQ:

c:\haskell> cd examples
c:\haskell> ghci LinqQuery.hs
....
LinqQuery> whereQuery

The package also includes tool support for automatically generating Haskell wrappers and types to .NET classes. The package assumes at least v2.0 of the .NET framework.

More info on package and its features at http://haskell.forkIO.com/dotnet


[Skip to Readme]

Modules

  • NET
    • NET.Base
    • System
      • NET.System.Action
        • NET.System.Action.Type
      • NET.System.Array
      • NET.System.AsyncCallback
        • NET.System.AsyncCallback.Type
      • NET.System.Char
      • Collections
        • NET.System.Collections.CollectionBase
        • Generic
          • NET.System.Collections.Generic.Dictionary
            • NET.System.Collections.Generic.Dictionary.Enumerator
              • NET.System.Collections.Generic.Dictionary.Enumerator.Type
            • NET.System.Collections.Generic.Dictionary.KeyCollection
              • NET.System.Collections.Generic.Dictionary.KeyCollection.Type
            • NET.System.Collections.Generic.Dictionary.Type
            • NET.System.Collections.Generic.Dictionary.ValueCollection
              • NET.System.Collections.Generic.Dictionary.ValueCollection.Type
          • NET.System.Collections.Generic.ICollection
            • NET.System.Collections.Generic.ICollection.Type
          • NET.System.Collections.Generic.IComparer
            • NET.System.Collections.Generic.IComparer.Type
          • NET.System.Collections.Generic.IDictionary
            • NET.System.Collections.Generic.IDictionary.Type
          • NET.System.Collections.Generic.IEnumerable
            • NET.System.Collections.Generic.IEnumerable.Type
          • NET.System.Collections.Generic.IEnumerator
            • NET.System.Collections.Generic.IEnumerator.Type
          • NET.System.Collections.Generic.IEqualityComparer
            • NET.System.Collections.Generic.IEqualityComparer.Type
          • NET.System.Collections.Generic.IList
            • NET.System.Collections.Generic.IList.Type
          • NET.System.Collections.Generic.KeyValuePair
            • NET.System.Collections.Generic.KeyValuePair.Type
          • NET.System.Collections.Generic.List
            • NET.System.Collections.Generic.List.Enumerator
              • NET.System.Collections.Generic.List.Enumerator.Type
            • NET.System.Collections.Generic.List.Type
          • NET.System.Collections.Generic.Queue
            • NET.System.Collections.Generic.Queue.Enumerator
              • NET.System.Collections.Generic.Queue.Enumerator.Type
            • NET.System.Collections.Generic.Queue.Type
        • NET.System.Collections.ICollection
          • NET.System.Collections.ICollection.Type
        • NET.System.Collections.IDictionary
          • NET.System.Collections.IDictionary.Type
        • NET.System.Collections.IEnumerable
          • NET.System.Collections.IEnumerable.Type
        • NET.System.Collections.IEnumerator
          • NET.System.Collections.IEnumerator.Type
        • NET.System.Collections.IList
          • NET.System.Collections.IList.Type
        • ObjectModel
          • NET.System.Collections.ObjectModel.ReadOnlyCollection
            • NET.System.Collections.ObjectModel.ReadOnlyCollection.Type
      • NET.System.Comparison
        • NET.System.Comparison.Type
      • NET.System.Converter
        • NET.System.Converter.Type
      • NET.System.DateTime
        • NET.System.DateTime.Type
      • NET.System.DateTimeKind
      • NET.System.DayOfWeek
      • NET.System.Decimal
        • NET.System.Decimal.Type
      • NET.System.Delegate
        • NET.System.Delegate.Type
      • NET.System.Enum
        • NET.System.Enum.Type
      • NET.System.EnumTy
      • NET.System.Func
        • NET.System.Func.Type
      • Globalization
        • NET.System.Globalization.Calendar
        • NET.System.Globalization.CalendarAlgorithmType
        • NET.System.Globalization.CalendarWeekRule
        • NET.System.Globalization.CompareInfo
        • NET.System.Globalization.CultureInfo
        • NET.System.Globalization.DateTimeFormatInfo
        • NET.System.Globalization.DateTimeStyles
        • NET.System.Globalization.DigitShapes
        • NET.System.Globalization.NumberFormatInfo
        • NET.System.Globalization.NumberStyles
        • NET.System.Globalization.SortKey
        • NET.System.Globalization.TextInfo
        • NET.System.Globalization.UnicodeCategory
      • NET.System.IAsyncResult
        • NET.System.IAsyncResult.Type
      • NET.System.ICloneable
        • NET.System.ICloneable.Type
      • NET.System.IComparable
        • NET.System.IComparable.Type
      • NET.System.IConvertible
        • NET.System.IConvertible.Type
      • NET.System.IDisposable
        • NET.System.IDisposable.Type
      • NET.System.IEquatable
        • NET.System.IEquatable.Type
      • NET.System.IFormatProvider
      • NET.System.IFormattable
        • NET.System.IFormattable.Type
      • IO
        • NET.System.IO.BinaryReader
          • NET.System.IO.BinaryReader.Type
        • NET.System.IO.BinaryWriter
          • NET.System.IO.BinaryWriter.Type
        • NET.System.IO.SeekOrigin
          • NET.System.IO.SeekOrigin.Type
        • NET.System.IO.Stream
          • NET.System.IO.Stream.Type
        • NET.System.IO.TextReader
        • NET.System.IO.TextWriter
      • NET.System.Int32
      • Linq
        • NET.System.Linq.Enumerable
          • NET.System.Linq.Enumerable.Type
        • NET.System.Linq.IGrouping
          • NET.System.Linq.IGrouping.Type
        • NET.System.Linq.ILookup
          • NET.System.Linq.ILookup.Type
        • NET.System.Linq.IOrderedEnumerable
          • NET.System.Linq.IOrderedEnumerable.Type
      • NET.System.MarshalByRefObject
        • NET.System.MarshalByRefObject.Type
      • NET.System.MulticastDelegate
        • NET.System.MulticastDelegate.Type
      • NET.System.Nullable
        • NET.System.Nullable.Type
      • NET.System.Object
      • NET.System.ObjectTy
      • NET.System.Predicate
        • NET.System.Predicate.Type
      • Runtime
        • Serialization
          • NET.System.Runtime.Serialization.ISerializable
            • NET.System.Runtime.Serialization.ISerializable.Type
          • NET.System.Runtime.Serialization.SerializationEntry
            • NET.System.Runtime.Serialization.SerializationEntry.Type
          • NET.System.Runtime.Serialization.SerializationInfo
            • NET.System.Runtime.Serialization.SerializationInfo.Type
          • NET.System.Runtime.Serialization.SerializationInfoEnumerator
            • NET.System.Runtime.Serialization.SerializationInfoEnumerator.Type
          • NET.System.Runtime.Serialization.StreamingContext
            • NET.System.Runtime.Serialization.StreamingContext.Type
          • NET.System.Runtime.Serialization.StreamingContextStates
            • NET.System.Runtime.Serialization.StreamingContextStates.Type
      • NET.System.String
        • NET.System.String.Type
      • NET.System.StringComparison
        • NET.System.StringComparison.Type
      • NET.System.StringTy
      • Text
        • NET.System.Text.Encoding
        • NET.System.Text.StringBuilder
      • NET.System.TimeSpan
        • NET.System.TimeSpan.Type
      • NET.System.Type
        • NET.System.Type.Type
      • NET.System.TypeCode
      • NET.System.TypeCodeTy
      • NET.System.TypeTy
      • NET.System.Uri
        • NET.System.Uri.Type
      • NET.System.UriComponents
        • NET.System.UriComponents.Type
      • NET.System.UriFormat
        • NET.System.UriFormat.Type
      • NET.System.UriHostNameType
        • NET.System.UriHostNameType.Type
      • NET.System.UriKind
        • NET.System.UriKind.Type
      • NET.System.UriPartial
        • NET.System.UriPartial.Type
      • NET.System.ValueType
        • NET.System.ValueType.Type

Flags

Automatic Flags
NameDescriptionDefault
old-base

Old, monolithic base

Disabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.3.0, 0.3.1, 0.4.0
Change log CHANGES
Dependencies base (<3 || >=4), ghc-prim [details]
License BSD-3-Clause
Author Sigbjorn Finne <sof@forkIO.com>
Maintainer Sigbjorn Finne <sof@forkIO.com>
Category .NET
Uploaded by SigbjornFinne at 2009-04-18T20:35:18Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 3029 total (7 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2017-01-01 [all 8 reports]

Readme for hs-dotnet-0.4.0

[back to package description]
== hs-dotnet: a pragmatic Haskell .NET interop layer ==

This is the README for hs-dotnet, a package that lets you access
and use .NET code / classes from Haskell (and vice versa..) 
Feel the power!

=== Web page ===

More info on the package, releases, etc can be found at

  http://haskell.forkIO.com/dotnet


=== Getting started ===

After having built _and_ installed the Cabal package, you're ready to
go. Have a look in the examples/ directory for some bare-bones
examples

== Generating class wrappers ==

While it is possible to access .NET without taking such a structured
approach, you may choose to generate Haskell wrapper modules for the
.NET-side classes you want to access. Writing these out by hand, and
in a manner that's type-safe, gets tiresome after a while and unncessarily
exposes you to RSI risks, so a tool is provided for this in... tools/

Simply name the class you want to wrap up, possibly along with the -d
flag, and it generates a Haskell module for the class. The tool has
a couple of shortcomings and limitations at the moment, but in most
cases that should give you a workable Haskell module. 

Improvements to wrapper generation is still evolving and expanded to 
make the interface to the .NET world more natural to the Haskell 
programmer.

=== Installation ===

Installation amounts to building and installing the Cabal package.

Notice that you will have to perform the install step before you are
able to use the package. The reason being that the supporting .NET
assembly (and accompanying COM classes) needs to be installed(GACed)
and published first. 

You may manually do this step by running 'gacInstaller' on HsInvoker.dll
and 'regasm' on same.