The clr-typed package

[ Tags: .net, bsd3, clr, ffi, language, library ] [ Propose Tags ]

Please see README.md


[Skip to Readme]

Properties

Versions 0.1.0.0, 0.2.0
Dependencies base (>=4.7 && <5), clr-marshal, ghc-prim, text, tuple [details]
License BSD3
Copyright Copyright: (c) 2016-2017 Tim Matthews
Author Tim Matthews
Maintainer pepeiborra@gmail.com
Category Language, FFI, CLR, .NET
Home page https://gitlab.com/tim-m89/clr-haskell/tree/master/libs/clr-typed
Bug tracker https://gitlab.com/tim-m89/clr-haskell/issues
Source repo head: git clone https://gitlab.com/tim-m89/clr-haskell/tree/master/libs/clr-typed
Uploaded Sat Aug 5 09:02:39 UTC 2017 by PepeIborra
Distributions NixOS:0.2.0
Downloads 508 total (16 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2017-08-05 [all 1 reports]
Hackage Matrix CI

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for clr-typed-0.2.0

[back to package description]

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" ()