-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Quasiquoters for inline C# and F# -- -- Please see README.md @package clr-inline @version 0.1.0.0 module Clr.Inline.Config data ClrInlineConfig ClrInlineConfig :: FilePath -> FilePath -> [String] -> [FilePath] -> Bool -> [String] -> ClrInlineConfig [configFSharpPath] :: ClrInlineConfig -> FilePath [configCSharpPath] :: ClrInlineConfig -> FilePath [configDependencies] :: ClrInlineConfig -> [String] [configExtraIncludeDirs] :: ClrInlineConfig -> [FilePath] [configDebugSymbols] :: ClrInlineConfig -> Bool [configCustomCompilerFlags] :: ClrInlineConfig -> [String] defaultMonoConfig :: ClrInlineConfig defaultDotNetConfig :: ClrInlineConfig defaultConfig :: ClrInlineConfig module Clr.Inline.Cabal -- | Add this to your Cabal Setup.hs driver in order to require the the F# -- compiler is in the path. -- --
-- import Clr.Inline.Cabal -- import Distribution.Simple -- -- main = defaultMainWithHooks $ ensureFSharp simpleUserHooks --ensureFSharp :: UserHooks -> UserHooks -- | Add this to your Cabal Setup.hs driver in order to require the the C# -- compiler is in the path. ensureCSharp :: UserHooks -> UserHooks module Clr.Inline -- | Quasiquoter for C# declarations and expressions. A quasiquote is a -- block of C# statements wrapped in curly braces preceded by the C# -- return type. Examples: -- --
-- example :: IO (Clr "int[]")
-- example = do
-- [csharp| Console.WriteLine("Hello CLR inline !!!"); |]
-- i <- [csharp| int { return 2; }|]
-- [csharp| int[] { int[] a = new int[4]{0,0,0,0};
-- for(int i=0; i < 4; i++) {
-- a[i] = i;
-- }
-- return a;
-- }|]
--
--
-- See the documentation for fsharp for details on the quotation
-- and antiquotation syntaxes. This quasiquoter is implicitly configured
-- with the defaultConfig.
csharp :: QuasiQuoter
-- | Explicit configuration version of csharp.
csharp' :: ClrInlineConfig -> QuasiQuoter
-- | F# declaration and expression quasiquoter. Declarations can include
-- open statements, types or even modules. Example declaration:
--
-- -- [fsharp| -- open System -- open System.Collections.Generic -- module Globals = -- let mutable today = DateTime.Today -- |] ---- -- Expressions are wrapped in a curly braces block {} that fixes -- the return type. An F# expression quotation can refer to a Haskell -- binding x using the syntax ($x:type) where type is a -- string denoting an F# type and is only required on the first usage, -- and the parentheses are optional. F# types are mapped to Haskell types -- via the Quotable class. An antiquotation $x:type is -- well-scoped if there exists a variable x with a Haskell type -- U in the Haskell context such that there exists an instance -- Quotable type clr marshall U for some clr and -- marshall. -- -- An F# expression returns an IO computation that produces a value of -- the quoted result type if said type is Quotable. Example -- expressions: -- --
-- hello :: IO (Int, Clr "System.DateTime")
-- hello = do
-- let year = 2017 :: Int
-- aClr <- [fsharp| DateTime{ DateTime($year:int,04,10)} |]
-- anInt <- [fsharp| int{ ($aClr:System.DateTime).Year + $year:int + $year}|]
-- return (anInt, anClr)
--
--
-- CLR Reference types are modelled in Haskell as Clr values,
-- indexed with the name of their F# type as a type level symbol. String
-- equivalence is a poor substitute for type equality, so for two
-- Clr values to have the same type they must be indexed by
-- exactly the same string.
--
-- This quasiquoter is implicitly configured with the
-- defaultConfig.
fsharp :: QuasiQuoter
-- | Explicit configuration version of fsharp.
fsharp' :: ClrInlineConfig -> QuasiQuoter
startClr :: IO ()
-- | Extensible mapping between quotable CLR types and Haskell types
class Unmarshal marshal haskell => Quotable (quoted :: Symbol) (clr :: Symbol) marshal haskell | marshal -> haskell clr
-- | A value of type FunPtr a is a pointer to a function
-- callable from foreign code. The type a will normally be a
-- foreign type, a function type with zero or more arguments where
--
-- -- foreign import ccall "stdlib.h &free" -- p_free :: FunPtr (Ptr a -> IO ()) ---- -- or a pointer to a Haskell function created using a wrapper stub -- declared to produce a FunPtr of the correct type. For example: -- --
-- type Compare = Int -> Int -> Bool -- foreign import ccall "wrapper" -- mkCompare :: Compare -> IO (FunPtr Compare) ---- -- Calls to wrapper stubs like mkCompare allocate storage, which -- should be released with freeHaskellFunPtr when no longer -- required. -- -- To convert FunPtr values to corresponding Haskell functions, -- one can define a dynamic stub for the specific foreign type, -- e.g. -- --
-- type IntFunction = CInt -> IO () -- foreign import ccall "dynamic" -- mkFun :: FunPtr IntFunction -> IntFunction --data FunPtr a :: * -> * newtype BStr :: * BStr :: Ptr Word16 -> BStr newtype TextBStr TextBStr :: BStr -> TextBStr -- | A wrapper around a ClrPtr, which will be released once this -- wrapper is no longer referenced. The only way to access the contents -- is in clr-inline quotations. data Clr (name :: Symbol) Clr :: (ClrPtr name) -> (IORef ()) -> Clr -- | A pointer to a Clr object. The only way to access the contents is via -- clr-inline quotations. newtype ClrPtr (name :: Symbol) ClrPtr :: Int64 -> ClrPtr