mathlink-2.0.1.1: mathlink.cabal
Name: mathlink
Version: 2.0.1.1
Cabal-Version: >= 1.6
Build-Type: Custom
License: BSD3
License-File: LICENSE
Copyright: Copyright (c) Tracy Wadleigh 2009
Author: Tracy Wadleigh
Maintainer: <tracy.wadleigh@gmail.com>
Bug-Reports: mailto:tracy.wadleigh@gmail.com?subject=dev-mathlink
Homepage: http://community.haskell.org/~TracyWadleigh/mathlink
Stability: experimental
Synopsis: Write Mathematica packages in Haskell
Tested-With: GHC >= 6.10.1
Category: Foreign
Extra-Source-Files: INSTALL
cbits/ml.h
example/README
example/Test.hs
example/test.sh
Extra-Tmp-Files: cbits/arch.h
mathlink.buildinfo
Description: {
Makes it easy to write /Mathematica/ packages in Haskell. Just write some
functions and provide a package specification in a simple DSL that
mimics that of /Mathematica/'s @mprep@ utility.
.
Data marshaling is accomplished via the 'MLGet' and 'MLPut' classes, which
specify types that that can be read from or written to the /MathLink/
connection. Instances of these classes are provided for the obvious
standard data types, including tuples, lists, and 'UArray's.
.
A Haskell function that is to be exposed to /Mathematica/ has the type
signature @('MLGet' a, 'MLPut' b) => a -> 'ML' b@. The 'ML' monad provides
single-threaded access to the /MathLink/ connection.
.
A simple example of a /Mathematica/ package:
.
@
import Foreign.MathLink
.
\-- define a function
addTwo :: (Int,Int) -> ML Int
addTwo (x,y) = return $ x+y
.
\-- specify a package
spec :: MLSpec
spec =
\ -- start a package definition
\ [ Eval $ \"BeginPackage\":\@[St \"Test\`\"]
.
\ -- define a usage message for the public symbol
\ , DeclMsg \"AddTwo\" \"usage\" \"AddTwo[..] adds a pair of numbers\"
.
\ -- open a new (private) namespace
\ , Eval $ \"Begin\":\@[St \"\`Private\`\"]
.
\ -- declare the function
\ , DeclFn {
\ callPattern = \"AddTwo[x_Integer,y_Integer]\"
\ , argPattern = \"{x,y}\"
\ , func = addTwo
\ }
.
\ -- close the namespaces
\ , Eval $ \"End\":\@[]
\ , Eval $ \"EndPackage\":\@[]
\ ]
.
\-- runs the /MathLink/ connection
main :: IO ()
main = runMathLink spec
@
}
Library
Build-Depends: base >= 4.0 && < 4.3,
mtl >= 1.1 && < 1.2,
haskell98,
array >= 0.2 && < 0.4,
containers >= 0.2 && < 0.4,
ix-shapable
Exposed-Modules: Foreign.MathLink
Foreign.MathLink.Expression
Foreign.MathLink.Internal
Include-Dirs: cbits
Includes: ml.h mathlink.h
C-Sources: cbits/ml.c
Build-Tools: c2hs >= 0.16
Ghc-Options: -fexcess-precision -funbox-strict-fields -Wall
Source-Repository head
Type: darcs
Location: http://community.haskell.org/~TracyWadleigh/darcs/mathlink/