@hackage clr-typed0.2.0

A strongly typed Haskell interface to the CLR type system

clr-typed - A strongly typed Haskell interface to the CLR type system

Status

unix build statusWindows Build status

Overview

This package provides a library to implement a strongly typed flavour for CLR <-> Haskell interoperability. It includes an encoding of OOP type system semantics within the GHC Haskell type system.

See the example for what it is currently capable of and how to use it.

What it looks like

  • CLR member & type names are specified with a type level Symbol, and are expected to be applied via the TypeApplications extension.
  • Arguments are tupled, so that overload resolution can see the full type up front. Unit is used for argument-less methods.
  • Method identifier comes first due to type applications.
resulta <- invokeI @"ObjMethodName" object ()  -- No arguments
resultb <- invokeI @"ObjMethodName" object "arg0"
resultc <- invokeI @"ObjMethodName" object ("arg1", 3, "hi")

  • Similarly for static methods. Method identifier again comes first for consistency with instance methods.
invokeS @"DoStuff" @"SomeClass" ()
  • Constructors are used in a similar fashion
obj <- new @"SomeType" ()
  • Generic type instantiations are done using a promoted tuple instead of just a Symbol
strList <- new @'("List", "String") ()
  • Generics may be used in a method identifier position in the same way
invokeS @'("SomeGenericMethod", "Integer") @"SomeClass" ()
  • Installation

  • Dependencies (0)

  • Dependents (0)