-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #270 from well-typed/codegen-macros
Generate Haskell code for function-like macros
- Loading branch information
Showing
27 changed files
with
1,031 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]])))))) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.