Skip to content

Commit

Permalink
Merge pull request #270 from well-typed/codegen-macros
Browse files Browse the repository at this point in the history
Generate Haskell code for function-like macros
  • Loading branch information
edsko authored Nov 13, 2024
2 parents fa2b3ae + 7c5620e commit 01b2bab
Show file tree
Hide file tree
Showing 27 changed files with 1,031 additions and 158 deletions.
3 changes: 1 addition & 2 deletions hs-bindgen/fixtures/enums.tree-diff.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ WrapCHeader
macroName = CName "ENUMS_H",
macroArgs = [],
macroBody = MTerm MEmpty},
macroDeclMacroTy = Just
"Empty"},
macroDeclMacroTy = "Empty"},
DeclEnum
Enu {
enumTag = Just (CName "first"),
Expand Down
10 changes: 9 additions & 1 deletion hs-bindgen/fixtures/macro_functions.hs
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
[]
[DeclVar (VarDecl "iNCR" (ForallTy ("a" ::: VNil) (Forall (\(x0 ::: VNil) -> (QuantTy {quantTyCts = [ClassTy Integral [TyVarTy x0]], quantTyBody = FunTy (TyVarTy x0) (TyVarTy x0)})))) (VarDeclLambda "x" (Lambda (\x0 -> VarDeclApp (InfixAppHead MAdd) [VarDeclVar x0, VarDeclIntegral 1 HsPrimCInt]))))
,DeclVar (VarDecl "aDD" (ForallTy ("a" ::: VNil) (Forall (\(x0 ::: VNil) -> (QuantTy {quantTyCts = [ClassTy Num [TyVarTy x0]], quantTyBody = FunTy (TyVarTy x0) (FunTy (TyVarTy x0) (TyVarTy x0))})))) (VarDeclLambda "x" (Lambda (\x0 -> VarDeclLambda "y" (Lambda (\x1 -> VarDeclApp (InfixAppHead MAdd) [VarDeclVar x0, VarDeclVar x1]))))))
,DeclVar (VarDecl "iD" (ForallTy ("a" ::: VNil) (Forall (\(x0 ::: VNil) -> (QuantTy {quantTyCts = [], quantTyBody = FunTy (TyVarTy x0) (TyVarTy x0)})))) (VarDeclLambda "x" (Lambda (\x0 -> VarDeclVar x0))))
,DeclVar (VarDecl "cONST" (ForallTy ("a" ::: "b" ::: VNil) (Forall (\(x0 ::: x1 ::: VNil) -> (QuantTy {quantTyCts = [], quantTyBody = FunTy (TyVarTy x0) (FunTy (TyVarTy x1) (TyVarTy x0))})))) (VarDeclLambda "x" (Lambda (\x0 -> VarDeclLambda "y" (Lambda (\x1 -> VarDeclVar x0))))))
,DeclVar (VarDecl "cMP" (ForallTy ("a" ::: VNil) (Forall (\(x0 ::: VNil) -> (QuantTy {quantTyCts = [ClassTy Ord [TyVarTy x0]], quantTyBody = FunTy (TyVarTy x0) (FunTy (TyVarTy x0) (TyConAppTy (TyConApp Bool [])))})))) (VarDeclLambda "x" (Lambda (\x0 -> VarDeclLambda "y" (Lambda (\x1 -> VarDeclApp (InfixAppHead MRelLT) [VarDeclVar x0, VarDeclVar x1]))))))
,DeclVar (VarDecl "fUN1" (ForallTy VNil (Forall (\( ::: VNil) -> (QuantTy {quantTyCts = [], quantTyBody = FunTy (TyConAppTy (TyConApp ULLong [])) (FunTy (TyConAppTy (TyConApp ULLong [])) (TyConAppTy (TyConApp ULLong [])))})))) (VarDeclLambda "x" (Lambda (\x0 -> VarDeclLambda "y" (Lambda (\x1 -> VarDeclApp (InfixAppHead MAdd) [VarDeclVar x0, VarDeclApp (InfixAppHead MMult) [VarDeclIntegral 12 HsPrimCULLong, VarDeclVar x1]]))))))
,DeclVar (VarDecl "fUN2" (ForallTy ("a" ::: VNil) (Forall (\(x0 ::: VNil) -> (QuantTy {quantTyCts = [ClassTy Bits [TyVarTy x0]], quantTyBody = FunTy (TyVarTy x0) (FunTy (TyConAppTy (TyConApp ULLong [])) (TyVarTy x0))})))) (VarDeclLambda "x" (Lambda (\x0 -> VarDeclLambda "y" (Lambda (\x1 -> VarDeclApp (InfixAppHead MShiftLeft) [VarDeclVar x0, VarDeclApp (InfixAppHead MMult) [VarDeclIntegral 3 HsPrimCULLong, VarDeclVar x1]]))))))
,DeclVar (VarDecl "g" (ForallTy ("a" ::: "b" ::: VNil) (Forall (\(x0 ::: x1 ::: VNil) -> (QuantTy {quantTyCts = [ClassTy Integral [TyVarTy x1]], quantTyBody = FunTy (TyVarTy x0) (FunTy (TyVarTy x1) (TyVarTy x1))})))) (VarDeclLambda "x" (Lambda (\x0 -> VarDeclLambda "y" (Lambda (\x1 -> VarDeclApp (VarApphead "cONST") [VarDeclApp (VarApphead "iNCR") [VarDeclVar x1], VarDeclApp (VarApphead "iD") [VarDeclVar x0]]))))))
]
27 changes: 27 additions & 0 deletions hs-bindgen/fixtures/macro_functions.pp.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,30 @@

module Example where

import qualified Data.Bits as DB
import qualified Foreign.C as FC
import qualified Prelude as P

iNCR :: forall a0. P.Integral a0 => a0 -> a0
iNCR = \x0 -> (P.+) x0 1

aDD :: forall a0. P.Num a0 => a0 -> a0 -> a0
aDD = \x0 -> \y1 -> (P.+) x0 y1

iD :: forall a0. a0 -> a0
iD = \x0 -> x0

cONST :: forall a0 b1. a0 -> b1 -> a0
cONST = \x0 -> \y1 -> x0

cMP :: forall a0. P.Ord a0 => a0 -> a0 -> FC.CBool
cMP = \x0 -> \y1 -> (P.<) x0 y1

fUN1 :: FC.CULLong -> FC.CULLong -> FC.CULLong
fUN1 = \x0 -> \y1 -> (P.+) x0 ((P.*) 12 y1)

fUN2 :: forall a0. DB.Bits a0 => a0 -> FC.CULLong -> a0
fUN2 = \x0 -> \y1 -> DB.shiftL x0 ((P.*) 3 y1)

g :: forall a0 b1. P.Integral b1 => a0 -> b1 -> b1
g = \x0 -> \y1 -> cONST (iNCR y1) (iD x0)
16 changes: 16 additions & 0 deletions hs-bindgen/fixtures/macro_functions.th.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
iNCR :: forall a_0 . Integral a_0 => a_0 -> a_0
iNCR = \x_0 -> (+) x_0 1
aDD :: forall a_0 . Num a_0 => a_0 -> a_0 -> a_0
aDD = \x_0 -> \y_1 -> (+) x_0 y_1
iD :: forall a_0 . a_0 -> a_0
iD = \x_0 -> x_0
cONST :: forall a_0 b_1 . a_0 -> b_1 -> a_0
cONST = \x_0 -> \y_1 -> x_0
cMP :: forall a_0 . Ord a_0 => a_0 -> a_0 -> CBool
cMP = \x_0 -> \y_1 -> (<) x_0 y_1
fUN1 :: CULLong -> CULLong -> CULLong
fUN1 = \x_0 -> \y_1 -> (+) x_0 ((*) 12 y_1)
fUN2 :: forall a_0 . Bits a_0 => a_0 -> CULLong -> a_0
fUN2 = \x_0 -> \y_1 -> shiftL x_0 ((*) 3 y_1)
g :: forall a_0 b_1 . Integral b_1 => a_0 -> b_1 -> b_1
g = \x_0 -> \y_1 -> cONST (iNCR y_1) (iD x_0)
32 changes: 16 additions & 16 deletions hs-bindgen/fixtures/macro_functions.tree-diff.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ WrapCHeader
integerLiteralText = "1",
integerLiteralType = Nothing,
integerLiteralValue = 1})]},
macroDeclMacroTy = Just
"(forall a. Integral a => (a -> a))"},
macroDeclMacroTy =
"(forall a. Integral a => (a -> a))"},
DeclMacro
MacroDecl {
macroDeclMacro = Macro {
Expand All @@ -50,8 +50,8 @@ WrapCHeader
[
MTerm (MVar (CName "x") []),
MTerm (MVar (CName "y") [])]},
macroDeclMacroTy = Just
"(forall a. Num a => (a -> a -> a))"},
macroDeclMacroTy =
"(forall a. Num a => (a -> a -> a))"},
DeclMacro
MacroDecl {
macroDeclMacro = Macro {
Expand All @@ -69,8 +69,8 @@ WrapCHeader
macroArgs = [CName "X"],
macroBody = MTerm
(MVar (CName "X") [])},
macroDeclMacroTy = Just
"(forall a. (a -> a))"},
macroDeclMacroTy =
"(forall a. (a -> a))"},
DeclMacro
MacroDecl {
macroDeclMacro = Macro {
Expand All @@ -90,8 +90,8 @@ WrapCHeader
CName "Y"],
macroBody = MTerm
(MVar (CName "X") [])},
macroDeclMacroTy = Just
"(forall a b. (a -> b -> a))"},
macroDeclMacroTy =
"(forall a b. (a -> b -> a))"},
DeclMacro
MacroDecl {
macroDeclMacro = Macro {
Expand All @@ -114,8 +114,8 @@ WrapCHeader
[
MTerm (MVar (CName "X") []),
MTerm (MVar (CName "Y") [])]},
macroDeclMacroTy = Just
"(forall a. Ord a => (a -> a -> Bool))"},
macroDeclMacroTy =
"(forall a. Ord a => (a -> a -> Bool))"},
DeclMacro
MacroDecl {
macroDeclMacro = Macro {
Expand Down Expand Up @@ -148,8 +148,8 @@ WrapCHeader
(PrimLongLong Unsigned),
integerLiteralValue = 12}),
MTerm (MVar (CName "Y") [])]]},
macroDeclMacroTy = Just
"(ULLong -> ULLong -> ULLong)"},
macroDeclMacroTy =
"(ULLong -> ULLong -> ULLong)"},
DeclMacro
MacroDecl {
macroDeclMacro = Macro {
Expand Down Expand Up @@ -182,8 +182,8 @@ WrapCHeader
(PrimLongLong Unsigned),
integerLiteralValue = 3}),
MTerm (MVar (CName "Y") [])]]},
macroDeclMacroTy = Just
"(forall a. Bits a => (a -> ULLong -> a))"},
macroDeclMacroTy =
"(forall a. Bits a => (a -> ULLong -> a))"},
DeclMacro
MacroDecl {
macroDeclMacro = Macro {
Expand Down Expand Up @@ -215,5 +215,5 @@ WrapCHeader
[
MTerm
(MVar (CName "X") [])])])},
macroDeclMacroTy = Just
"(forall a b. Integral b => (a -> b -> b))"}])
macroDeclMacroTy =
"(forall a b. Integral b => (a -> b -> b))"}])
33 changes: 32 additions & 1 deletion hs-bindgen/fixtures/macros.hs
Original file line number Diff line number Diff line change
@@ -1 +1,32 @@
[]
[DeclVar (VarDecl "oBJECTLIKE1" (ForallTy ("a" ::: VNil) (Forall (\(x0 ::: VNil) -> (QuantTy {quantTyCts = [ClassTy Integral [TyVarTy x0]], quantTyBody = TyVarTy x0})))) (VarDeclIntegral 1 HsPrimCInt))
,DeclVar (VarDecl "oBJECTLIKE2" (ForallTy ("a" ::: VNil) (Forall (\(x0 ::: VNil) -> (QuantTy {quantTyCts = [ClassTy Integral [TyVarTy x0]], quantTyBody = TyVarTy x0})))) (VarDeclIntegral 2 HsPrimCInt))
,DeclVar (VarDecl "oBJECTLIKE3" (ForallTy ("a" ::: VNil) (Forall (\(x0 ::: VNil) -> (QuantTy {quantTyCts = [ClassTy Integral [TyVarTy x0]], quantTyBody = TyVarTy x0})))) (VarDeclApp (InfixAppHead MAdd) [VarDeclIntegral 3 HsPrimCInt, VarDeclIntegral 3 HsPrimCInt]))
,DeclVar (VarDecl "oBJECTLIKE4" (ForallTy ("a" ::: VNil) (Forall (\(x0 ::: VNil) -> (QuantTy {quantTyCts = [ClassTy Integral [TyVarTy x0]], quantTyBody = TyVarTy x0})))) (VarDeclApp (InfixAppHead MAdd) [VarDeclIntegral 4 HsPrimCInt, VarDeclIntegral 4 HsPrimCInt]))
,DeclVar (VarDecl "mEANING_OF_LIFE1" (ForallTy ("a" ::: VNil) (Forall (\(x0 ::: VNil) -> (QuantTy {quantTyCts = [ClassTy Integral [TyVarTy x0]], quantTyBody = TyVarTy x0})))) (VarDeclIntegral 42 HsPrimCInt))
,DeclVar (VarDecl "mEANING_OF_LIFE2" (ForallTy ("a" ::: VNil) (Forall (\(x0 ::: VNil) -> (QuantTy {quantTyCts = [ClassTy Integral [TyVarTy x0]], quantTyBody = TyVarTy x0})))) (VarDeclIntegral 42 HsPrimCInt))
,DeclVar (VarDecl "mEANING_OF_LIFE3" (ForallTy ("a" ::: VNil) (Forall (\(x0 ::: VNil) -> (QuantTy {quantTyCts = [ClassTy Integral [TyVarTy x0]], quantTyBody = TyVarTy x0})))) (VarDeclIntegral 42 HsPrimCInt))
,DeclVar (VarDecl "mEANING_OF_LIFE4" (ForallTy ("a" ::: VNil) (Forall (\(x0 ::: VNil) -> (QuantTy {quantTyCts = [ClassTy Integral [TyVarTy x0]], quantTyBody = TyVarTy x0})))) (VarDeclIntegral 42 HsPrimCInt))
,DeclVar (VarDecl "mEANING_OF_LIFE5" (ForallTy ("a" ::: VNil) (Forall (\(x0 ::: VNil) -> (QuantTy {quantTyCts = [ClassTy Integral [TyVarTy x0]], quantTyBody = TyVarTy x0})))) (VarDeclIntegral 42 HsPrimCInt))
,DeclVar (VarDecl "lONG_INT_TOKEN1" (ForallTy VNil (Forall (\( ::: VNil) -> (QuantTy {quantTyCts = [], quantTyBody = TyConAppTy (TyConApp ULLong [])})))) (VarDeclIntegral 18446744073709550592 HsPrimCULLong))
,DeclVar (VarDecl "lONG_INT_TOKEN2" (ForallTy VNil (Forall (\( ::: VNil) -> (QuantTy {quantTyCts = [], quantTyBody = TyConAppTy (TyConApp ULLong [])})))) (VarDeclIntegral 18446744073709550592 HsPrimCULLong))
,DeclVar (VarDecl "lONG_INT_TOKEN3" (ForallTy VNil (Forall (\( ::: VNil) -> (QuantTy {quantTyCts = [], quantTyBody = TyConAppTy (TyConApp ULLong [])})))) (VarDeclIntegral 18446744073709550592 HsPrimCULLong))
,DeclVar (VarDecl "lONG_INT_TOKEN4" (ForallTy VNil (Forall (\( ::: VNil) -> (QuantTy {quantTyCts = [], quantTyBody = TyConAppTy (TyConApp ULLong [])})))) (VarDeclIntegral 18446744073709550592 HsPrimCULLong))
,DeclVar (VarDecl "fLT1_1" (ForallTy ("a" ::: VNil) (Forall (\(x0 ::: VNil) -> (QuantTy {quantTyCts = [ClassTy Fractional [TyVarTy x0]], quantTyBody = TyVarTy x0})))) (VarDeclDouble 110000.0))
,DeclVar (VarDecl "fLT1_2" (ForallTy ("a" ::: VNil) (Forall (\(x0 ::: VNil) -> (QuantTy {quantTyCts = [ClassTy Fractional [TyVarTy x0]], quantTyBody = TyVarTy x0})))) (VarDeclDouble 1.2e-2))
,DeclVar (VarDecl "fLT1_3" (ForallTy VNil (Forall (\( ::: VNil) -> (QuantTy {quantTyCts = [], quantTyBody = TyConAppTy (TyConApp Float [])})))) (VarDeclFloat 1.3e-2))
,DeclVar (VarDecl "fLT2_1" (ForallTy ("a" ::: VNil) (Forall (\(x0 ::: VNil) -> (QuantTy {quantTyCts = [ClassTy Fractional [TyVarTy x0]], quantTyBody = TyVarTy x0})))) (VarDeclDouble 21.0))
,DeclVar (VarDecl "fLT2_2" (ForallTy ("a" ::: VNil) (Forall (\(x0 ::: VNil) -> (QuantTy {quantTyCts = [ClassTy Fractional [TyVarTy x0]], quantTyBody = TyVarTy x0})))) (VarDeclDouble 2200.0))
,DeclVar (VarDecl "fLT2_3" (ForallTy VNil (Forall (\( ::: VNil) -> (QuantTy {quantTyCts = [], quantTyBody = TyConAppTy (TyConApp Float [])})))) (VarDeclFloat 23.0))
,DeclVar (VarDecl "fLT3_1" (ForallTy ("a" ::: VNil) (Forall (\(x0 ::: VNil) -> (QuantTy {quantTyCts = [ClassTy Fractional [TyVarTy x0]], quantTyBody = TyVarTy x0})))) (VarDeclDouble 31.0))
,DeclVar (VarDecl "fLT3_2" (ForallTy ("a" ::: VNil) (Forall (\(x0 ::: VNil) -> (QuantTy {quantTyCts = [ClassTy Fractional [TyVarTy x0]], quantTyBody = TyVarTy x0})))) (VarDeclDouble 0.32))
,DeclVar (VarDecl "fLT3_3" (ForallTy ("a" ::: VNil) (Forall (\(x0 ::: VNil) -> (QuantTy {quantTyCts = [ClassTy Fractional [TyVarTy x0]], quantTyBody = TyVarTy x0})))) (VarDeclDouble 33.0))
,DeclVar (VarDecl "fLT3_4" (ForallTy VNil (Forall (\( ::: VNil) -> (QuantTy {quantTyCts = [], quantTyBody = TyConAppTy (TyConApp Float [])})))) (VarDeclFloat 3.4e-3))
,DeclVar (VarDecl "fLT4_1" (ForallTy ("a" ::: VNil) (Forall (\(x0 ::: VNil) -> (QuantTy {quantTyCts = [ClassTy Fractional [TyVarTy x0]], quantTyBody = TyVarTy x0})))) (VarDeclDouble 650000.0))
,DeclVar (VarDecl "fLT4_2" (ForallTy ("a" ::: VNil) (Forall (\(x0 ::: VNil) -> (QuantTy {quantTyCts = [ClassTy Fractional [TyVarTy x0]], quantTyBody = TyVarTy x0})))) (VarDeclDouble 6.6e-2))
,DeclVar (VarDecl "fLT4_3" (ForallTy VNil (Forall (\( ::: VNil) -> (QuantTy {quantTyCts = [], quantTyBody = TyConAppTy (TyConApp Float [])})))) (VarDeclFloat 6.7e-2))
,DeclVar (VarDecl "fLT5_1" (ForallTy ("a" ::: VNil) (Forall (\(x0 ::: VNil) -> (QuantTy {quantTyCts = [ClassTy Fractional [TyVarTy x0]], quantTyBody = TyVarTy x0})))) (VarDeclDouble 81.0))
,DeclVar (VarDecl "fLT5_2" (ForallTy VNil (Forall (\( ::: VNil) -> (QuantTy {quantTyCts = [], quantTyBody = TyConAppTy (TyConApp Float [])})))) (VarDeclFloat 82.0))
,DeclVar (VarDecl "fLT6_1" (ForallTy ("a" ::: VNil) (Forall (\(x0 ::: VNil) -> (QuantTy {quantTyCts = [ClassTy Fractional [TyVarTy x0]], quantTyBody = TyVarTy x0})))) (VarDeclDouble 15520.0))
,DeclVar (VarDecl "fLT6_2" (ForallTy ("a" ::: VNil) (Forall (\(x0 ::: VNil) -> (QuantTy {quantTyCts = [ClassTy Fractional [TyVarTy x0]], quantTyBody = TyVarTy x0})))) (VarDeclDouble 98.0))
,DeclVar (VarDecl "fLT6_3" (ForallTy VNil (Forall (\( ::: VNil) -> (QuantTy {quantTyCts = [], quantTyBody = TyConAppTy (TyConApp Float [])})))) (VarDeclFloat 9.9e-3))
]
95 changes: 95 additions & 0 deletions hs-bindgen/fixtures/macros.pp.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,98 @@

module Example where

import qualified Foreign.C as FC
import qualified Prelude as P

oBJECTLIKE1 :: forall a0. P.Integral a0 => a0
oBJECTLIKE1 = 1

oBJECTLIKE2 :: forall a0. P.Integral a0 => a0
oBJECTLIKE2 = 2

oBJECTLIKE3 :: forall a0. P.Integral a0 => a0
oBJECTLIKE3 = (P.+) 3 3

oBJECTLIKE4 :: forall a0. P.Integral a0 => a0
oBJECTLIKE4 = (P.+) 4 4

mEANING_OF_LIFE1 :: forall a0. P.Integral a0 => a0
mEANING_OF_LIFE1 = 42

mEANING_OF_LIFE2 :: forall a0. P.Integral a0 => a0
mEANING_OF_LIFE2 = 42

mEANING_OF_LIFE3 :: forall a0. P.Integral a0 => a0
mEANING_OF_LIFE3 = 42

mEANING_OF_LIFE4 :: forall a0. P.Integral a0 => a0
mEANING_OF_LIFE4 = 42

mEANING_OF_LIFE5 :: forall a0. P.Integral a0 => a0
mEANING_OF_LIFE5 = 42

lONG_INT_TOKEN1 :: FC.CULLong
lONG_INT_TOKEN1 = 18446744073709550592

lONG_INT_TOKEN2 :: FC.CULLong
lONG_INT_TOKEN2 = 18446744073709550592

lONG_INT_TOKEN3 :: FC.CULLong
lONG_INT_TOKEN3 = 18446744073709550592

lONG_INT_TOKEN4 :: FC.CULLong
lONG_INT_TOKEN4 = 18446744073709550592

fLT1_1 :: forall a0. P.Fractional a0 => a0
fLT1_1 = 110000.0

fLT1_2 :: forall a0. P.Fractional a0 => a0
fLT1_2 = 1.2e-2

fLT1_3 :: FC.CFloat
fLT1_3 = 1.3e-2

fLT2_1 :: forall a0. P.Fractional a0 => a0
fLT2_1 = 21.0

fLT2_2 :: forall a0. P.Fractional a0 => a0
fLT2_2 = 2200.0

fLT2_3 :: FC.CFloat
fLT2_3 = 23.0

fLT3_1 :: forall a0. P.Fractional a0 => a0
fLT3_1 = 31.0

fLT3_2 :: forall a0. P.Fractional a0 => a0
fLT3_2 = 0.32

fLT3_3 :: forall a0. P.Fractional a0 => a0
fLT3_3 = 33.0

fLT3_4 :: FC.CFloat
fLT3_4 = 3.4e-3

fLT4_1 :: forall a0. P.Fractional a0 => a0
fLT4_1 = 650000.0

fLT4_2 :: forall a0. P.Fractional a0 => a0
fLT4_2 = 6.6e-2

fLT4_3 :: FC.CFloat
fLT4_3 = 6.7e-2

fLT5_1 :: forall a0. P.Fractional a0 => a0
fLT5_1 = 81.0

fLT5_2 :: FC.CFloat
fLT5_2 = 82.0

fLT6_1 :: forall a0. P.Fractional a0 => a0
fLT6_1 = 15520.0

fLT6_2 :: forall a0. P.Fractional a0 => a0
fLT6_2 = 98.0

fLT6_3 :: FC.CFloat
fLT6_3 = 9.9e-3
62 changes: 62 additions & 0 deletions hs-bindgen/fixtures/macros.th.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
oBJECTLIKE1 :: forall a_0 . Integral a_0 => a_0
oBJECTLIKE1 = 1
oBJECTLIKE2 :: forall a_0 . Integral a_0 => a_0
oBJECTLIKE2 = 2
oBJECTLIKE3 :: forall a_0 . Integral a_0 => a_0
oBJECTLIKE3 = (+) 3 3
oBJECTLIKE4 :: forall a_0 . Integral a_0 => a_0
oBJECTLIKE4 = (+) 4 4
mEANING_OF_LIFE1 :: forall a_0 . Integral a_0 => a_0
mEANING_OF_LIFE1 = 42
mEANING_OF_LIFE2 :: forall a_0 . Integral a_0 => a_0
mEANING_OF_LIFE2 = 42
mEANING_OF_LIFE3 :: forall a_0 . Integral a_0 => a_0
mEANING_OF_LIFE3 = 42
mEANING_OF_LIFE4 :: forall a_0 . Integral a_0 => a_0
mEANING_OF_LIFE4 = 42
mEANING_OF_LIFE5 :: forall a_0 . Integral a_0 => a_0
mEANING_OF_LIFE5 = 42
lONG_INT_TOKEN1 :: CULLong
lONG_INT_TOKEN1 = 18446744073709550592
lONG_INT_TOKEN2 :: CULLong
lONG_INT_TOKEN2 = 18446744073709550592
lONG_INT_TOKEN3 :: CULLong
lONG_INT_TOKEN3 = 18446744073709550592
lONG_INT_TOKEN4 :: CULLong
lONG_INT_TOKEN4 = 18446744073709550592
fLT1_1 :: forall a_0 . Fractional a_0 => a_0
fLT1_1 = 110000.0
fLT1_2 :: forall a_0 . Fractional a_0 => a_0
fLT1_2 = 0.0120000000000000002498001805406602215953171253204345703125
fLT1_3 :: CFloat
fLT1_3 = 0.0130000002682209014892578125
fLT2_1 :: forall a_0 . Fractional a_0 => a_0
fLT2_1 = 21.0
fLT2_2 :: forall a_0 . Fractional a_0 => a_0
fLT2_2 = 2200.0
fLT2_3 :: CFloat
fLT2_3 = 23.0
fLT3_1 :: forall a_0 . Fractional a_0 => a_0
fLT3_1 = 31.0
fLT3_2 :: forall a_0 . Fractional a_0 => a_0
fLT3_2 = 0.320000000000000006661338147750939242541790008544921875
fLT3_3 :: forall a_0 . Fractional a_0 => a_0
fLT3_3 = 33.0
fLT3_4 :: CFloat
fLT3_4 = 3.40000004507601261138916015625e-3
fLT4_1 :: forall a_0 . Fractional a_0 => a_0
fLT4_1 = 650000.0
fLT4_2 :: forall a_0 . Fractional a_0 => a_0
fLT4_2 = 0.066000000000000003108624468950438313186168670654296875
fLT4_3 :: CFloat
fLT4_3 = 0.0670000016689300537109375
fLT5_1 :: forall a_0 . Fractional a_0 => a_0
fLT5_1 = 81.0
fLT5_2 :: CFloat
fLT5_2 = 82.0
fLT6_1 :: forall a_0 . Fractional a_0 => a_0
fLT6_1 = 15520.0
fLT6_2 :: forall a_0 . Fractional a_0 => a_0
fLT6_2 = 98.0
fLT6_3 :: CFloat
fLT6_3 = 9.8999999463558197021484375e-3
Loading

0 comments on commit 01b2bab

Please sign in to comment.