From efcb1ff5a4eb57fa00a546f52fdc6b08ae63a141 Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Thu, 17 Oct 2024 15:30:43 +0300 Subject: [PATCH] Add placeholder for struct field types --- hs-bindgen/fixtures/enums.hs | 2 +- hs-bindgen/fixtures/fixedwidth.hs | 2 +- hs-bindgen/fixtures/nested_types.hs | 2 +- hs-bindgen/fixtures/primitive_types.hs | 2 +- hs-bindgen/fixtures/simple_structs.hs | 2 +- hs-bindgen/fixtures/typedef_vs_macro.hs | 2 +- hs-bindgen/fixtures/uses_utf8.hs | 2 +- .../src/HsBindgen/Backend/Common/Translation.hs | 8 ++++++-- hs-bindgen/src/HsBindgen/Hs/AST.hs | 12 +++++++++++- hs-bindgen/src/HsBindgen/Translation/LowLevel.hs | 11 ++++++++--- hs-bindgen/test-th/HsBindgen/TestTH/Examples.hs | 2 +- 11 files changed, 33 insertions(+), 14 deletions(-) diff --git a/hs-bindgen/fixtures/enums.hs b/hs-bindgen/fixtures/enums.hs index 3dcbde2..5ceda8f 100644 --- a/hs-bindgen/fixtures/enums.hs +++ b/hs-bindgen/fixtures/enums.hs @@ -1 +1 @@ -List {getList = [DeclInstance (InstanceStorable (WithStruct (Struct {structName = "First", structConstr = "MkFirst", structFields = "unfirst" ::: VNil}) (StorableInstance {storableSizeOf = 4, storableAlignment = 4, storablePeek = Lambda (\x0 -> Ap (IntroStruct (Struct {structName = "First", structConstr = "MkFirst", structFields = "unfirst" ::: VNil})) [PeekByteOff x0 0]), storablePoke = Lambda (\x0 -> ElimStruct (Struct {structName = "First", structConstr = "MkFirst", structFields = "unfirst" ::: VNil}) (\(x1 ::: VNil) -> (Seq (List {getList = [PokeByteOff x0 0 x1]}))))}))), DeclInstance (InstanceStorable (WithStruct (Struct {structName = "Second", structConstr = "MkSecond", structFields = "unsecond" ::: VNil}) (StorableInstance {storableSizeOf = 4, storableAlignment = 4, storablePeek = Lambda (\x0 -> Ap (IntroStruct (Struct {structName = "Second", structConstr = "MkSecond", structFields = "unsecond" ::: VNil})) [PeekByteOff x0 0]), storablePoke = Lambda (\x0 -> ElimStruct (Struct {structName = "Second", structConstr = "MkSecond", structFields = "unsecond" ::: VNil}) (\(x1 ::: VNil) -> (Seq (List {getList = [PokeByteOff x0 0 x1]}))))}))), DeclInstance (InstanceStorable (WithStruct (Struct {structName = "Same", structConstr = "MkSame", structFields = "unsame" ::: VNil}) (StorableInstance {storableSizeOf = 4, storableAlignment = 4, storablePeek = Lambda (\x0 -> Ap (IntroStruct (Struct {structName = "Same", structConstr = "MkSame", structFields = "unsame" ::: VNil})) [PeekByteOff x0 0]), storablePoke = Lambda (\x0 -> ElimStruct (Struct {structName = "Same", structConstr = "MkSame", structFields = "unsame" ::: VNil}) (\(x1 ::: VNil) -> (Seq (List {getList = [PokeByteOff x0 0 x1]}))))}))), DeclInstance (InstanceStorable (WithStruct (Struct {structName = "Packad", structConstr = "MkPackad", structFields = "unpackad" ::: VNil}) (StorableInstance {storableSizeOf = 1, storableAlignment = 1, storablePeek = Lambda (\x0 -> Ap (IntroStruct (Struct {structName = "Packad", structConstr = "MkPackad", structFields = "unpackad" ::: VNil})) [PeekByteOff x0 0]), storablePoke = Lambda (\x0 -> ElimStruct (Struct {structName = "Packad", structConstr = "MkPackad", structFields = "unpackad" ::: VNil}) (\(x1 ::: VNil) -> (Seq (List {getList = [PokeByteOff x0 0 x1]}))))})))]} \ No newline at end of file +List {getList = [DeclInstance (InstanceStorable (WithStruct (Struct {structName = "First", structConstr = "MkFirst", structFields = ("unfirst",HsType "EnumTypeTODO") ::: VNil}) (StorableInstance {storableSizeOf = 4, storableAlignment = 4, storablePeek = Lambda (\x0 -> Ap (IntroStruct (Struct {structName = "First", structConstr = "MkFirst", structFields = ("unfirst",HsType "EnumTypeTODO") ::: VNil})) [PeekByteOff x0 0]), storablePoke = Lambda (\x0 -> ElimStruct (Struct {structName = "First", structConstr = "MkFirst", structFields = ("unfirst",HsType "EnumTypeTODO") ::: VNil}) (\(x1 ::: VNil) -> (Seq (List {getList = [PokeByteOff x0 0 x1]}))))}))), DeclInstance (InstanceStorable (WithStruct (Struct {structName = "Second", structConstr = "MkSecond", structFields = ("unsecond",HsType "EnumTypeTODO") ::: VNil}) (StorableInstance {storableSizeOf = 4, storableAlignment = 4, storablePeek = Lambda (\x0 -> Ap (IntroStruct (Struct {structName = "Second", structConstr = "MkSecond", structFields = ("unsecond",HsType "EnumTypeTODO") ::: VNil})) [PeekByteOff x0 0]), storablePoke = Lambda (\x0 -> ElimStruct (Struct {structName = "Second", structConstr = "MkSecond", structFields = ("unsecond",HsType "EnumTypeTODO") ::: VNil}) (\(x1 ::: VNil) -> (Seq (List {getList = [PokeByteOff x0 0 x1]}))))}))), DeclInstance (InstanceStorable (WithStruct (Struct {structName = "Same", structConstr = "MkSame", structFields = ("unsame",HsType "EnumTypeTODO") ::: VNil}) (StorableInstance {storableSizeOf = 4, storableAlignment = 4, storablePeek = Lambda (\x0 -> Ap (IntroStruct (Struct {structName = "Same", structConstr = "MkSame", structFields = ("unsame",HsType "EnumTypeTODO") ::: VNil})) [PeekByteOff x0 0]), storablePoke = Lambda (\x0 -> ElimStruct (Struct {structName = "Same", structConstr = "MkSame", structFields = ("unsame",HsType "EnumTypeTODO") ::: VNil}) (\(x1 ::: VNil) -> (Seq (List {getList = [PokeByteOff x0 0 x1]}))))}))), DeclInstance (InstanceStorable (WithStruct (Struct {structName = "Packad", structConstr = "MkPackad", structFields = ("unpackad",HsType "EnumTypeTODO") ::: VNil}) (StorableInstance {storableSizeOf = 1, storableAlignment = 1, storablePeek = Lambda (\x0 -> Ap (IntroStruct (Struct {structName = "Packad", structConstr = "MkPackad", structFields = ("unpackad",HsType "EnumTypeTODO") ::: VNil})) [PeekByteOff x0 0]), storablePoke = Lambda (\x0 -> ElimStruct (Struct {structName = "Packad", structConstr = "MkPackad", structFields = ("unpackad",HsType "EnumTypeTODO") ::: VNil}) (\(x1 ::: VNil) -> (Seq (List {getList = [PokeByteOff x0 0 x1]}))))})))]} \ No newline at end of file diff --git a/hs-bindgen/fixtures/fixedwidth.hs b/hs-bindgen/fixtures/fixedwidth.hs index 3cc5161..8997603 100644 --- a/hs-bindgen/fixtures/fixedwidth.hs +++ b/hs-bindgen/fixtures/fixedwidth.hs @@ -1 +1 @@ -List {getList = [DeclData (WithStruct (Struct {structName = "Foo", structConstr = "MkFoo", structFields = "sixty_four" ::: "thirty_two" ::: VNil}) (MkDataDecl)), DeclInstance (InstanceStorable (WithStruct (Struct {structName = "Foo", structConstr = "MkFoo", structFields = "sixty_four" ::: "thirty_two" ::: VNil}) (StorableInstance {storableSizeOf = 16, storableAlignment = 8, storablePeek = Lambda (\x0 -> Ap (IntroStruct (Struct {structName = "Foo", structConstr = "MkFoo", structFields = "sixty_four" ::: "thirty_two" ::: VNil})) [PeekByteOff x0 0, PeekByteOff x0 64]), storablePoke = Lambda (\x0 -> ElimStruct (Struct {structName = "Foo", structConstr = "MkFoo", structFields = "sixty_four" ::: "thirty_two" ::: VNil}) (\(x1 ::: x2 ::: VNil) -> (Seq (List {getList = [PokeByteOff x0 0 x1, PokeByteOff x0 64 x2]}))))})))]} \ No newline at end of file +List {getList = [DeclData (WithStruct (Struct {structName = "Foo", structConstr = "MkFoo", structFields = ("sixty_four",HsType "StructFieldTypeTODO") ::: ("thirty_two",HsType "StructFieldTypeTODO") ::: VNil}) (MkDataDecl)), DeclInstance (InstanceStorable (WithStruct (Struct {structName = "Foo", structConstr = "MkFoo", structFields = ("sixty_four",HsType "StructFieldTypeTODO") ::: ("thirty_two",HsType "StructFieldTypeTODO") ::: VNil}) (StorableInstance {storableSizeOf = 16, storableAlignment = 8, storablePeek = Lambda (\x0 -> Ap (IntroStruct (Struct {structName = "Foo", structConstr = "MkFoo", structFields = ("sixty_four",HsType "StructFieldTypeTODO") ::: ("thirty_two",HsType "StructFieldTypeTODO") ::: VNil})) [PeekByteOff x0 0, PeekByteOff x0 64]), storablePoke = Lambda (\x0 -> ElimStruct (Struct {structName = "Foo", structConstr = "MkFoo", structFields = ("sixty_four",HsType "StructFieldTypeTODO") ::: ("thirty_two",HsType "StructFieldTypeTODO") ::: VNil}) (\(x1 ::: x2 ::: VNil) -> (Seq (List {getList = [PokeByteOff x0 0 x1, PokeByteOff x0 64 x2]}))))})))]} \ No newline at end of file diff --git a/hs-bindgen/fixtures/nested_types.hs b/hs-bindgen/fixtures/nested_types.hs index 3efc9e0..880da50 100644 --- a/hs-bindgen/fixtures/nested_types.hs +++ b/hs-bindgen/fixtures/nested_types.hs @@ -1 +1 @@ -List {getList = [DeclData (WithStruct (Struct {structName = "Foo", structConstr = "MkFoo", structFields = "i" ::: "c" ::: VNil}) (MkDataDecl)), DeclInstance (InstanceStorable (WithStruct (Struct {structName = "Foo", structConstr = "MkFoo", structFields = "i" ::: "c" ::: VNil}) (StorableInstance {storableSizeOf = 8, storableAlignment = 4, storablePeek = Lambda (\x0 -> Ap (IntroStruct (Struct {structName = "Foo", structConstr = "MkFoo", structFields = "i" ::: "c" ::: VNil})) [PeekByteOff x0 0, PeekByteOff x0 32]), storablePoke = Lambda (\x0 -> ElimStruct (Struct {structName = "Foo", structConstr = "MkFoo", structFields = "i" ::: "c" ::: VNil}) (\(x1 ::: x2 ::: VNil) -> (Seq (List {getList = [PokeByteOff x0 0 x1, PokeByteOff x0 32 x2]}))))}))), DeclData (WithStruct (Struct {structName = "Bar", structConstr = "MkBar", structFields = "foo1" ::: "foo2" ::: VNil}) (MkDataDecl)), DeclInstance (InstanceStorable (WithStruct (Struct {structName = "Bar", structConstr = "MkBar", structFields = "foo1" ::: "foo2" ::: VNil}) (StorableInstance {storableSizeOf = 16, storableAlignment = 4, storablePeek = Lambda (\x0 -> Ap (IntroStruct (Struct {structName = "Bar", structConstr = "MkBar", structFields = "foo1" ::: "foo2" ::: VNil})) [PeekByteOff x0 0, PeekByteOff x0 64]), storablePoke = Lambda (\x0 -> ElimStruct (Struct {structName = "Bar", structConstr = "MkBar", structFields = "foo1" ::: "foo2" ::: VNil}) (\(x1 ::: x2 ::: VNil) -> (Seq (List {getList = [PokeByteOff x0 0 x1, PokeByteOff x0 64 x2]}))))})))]} \ No newline at end of file +List {getList = [DeclData (WithStruct (Struct {structName = "Foo", structConstr = "MkFoo", structFields = ("i",HsType "StructFieldTypeTODO") ::: ("c",HsType "StructFieldTypeTODO") ::: VNil}) (MkDataDecl)), DeclInstance (InstanceStorable (WithStruct (Struct {structName = "Foo", structConstr = "MkFoo", structFields = ("i",HsType "StructFieldTypeTODO") ::: ("c",HsType "StructFieldTypeTODO") ::: VNil}) (StorableInstance {storableSizeOf = 8, storableAlignment = 4, storablePeek = Lambda (\x0 -> Ap (IntroStruct (Struct {structName = "Foo", structConstr = "MkFoo", structFields = ("i",HsType "StructFieldTypeTODO") ::: ("c",HsType "StructFieldTypeTODO") ::: VNil})) [PeekByteOff x0 0, PeekByteOff x0 32]), storablePoke = Lambda (\x0 -> ElimStruct (Struct {structName = "Foo", structConstr = "MkFoo", structFields = ("i",HsType "StructFieldTypeTODO") ::: ("c",HsType "StructFieldTypeTODO") ::: VNil}) (\(x1 ::: x2 ::: VNil) -> (Seq (List {getList = [PokeByteOff x0 0 x1, PokeByteOff x0 32 x2]}))))}))), DeclData (WithStruct (Struct {structName = "Bar", structConstr = "MkBar", structFields = ("foo1",HsType "StructFieldTypeTODO") ::: ("foo2",HsType "StructFieldTypeTODO") ::: VNil}) (MkDataDecl)), DeclInstance (InstanceStorable (WithStruct (Struct {structName = "Bar", structConstr = "MkBar", structFields = ("foo1",HsType "StructFieldTypeTODO") ::: ("foo2",HsType "StructFieldTypeTODO") ::: VNil}) (StorableInstance {storableSizeOf = 16, storableAlignment = 4, storablePeek = Lambda (\x0 -> Ap (IntroStruct (Struct {structName = "Bar", structConstr = "MkBar", structFields = ("foo1",HsType "StructFieldTypeTODO") ::: ("foo2",HsType "StructFieldTypeTODO") ::: VNil})) [PeekByteOff x0 0, PeekByteOff x0 64]), storablePoke = Lambda (\x0 -> ElimStruct (Struct {structName = "Bar", structConstr = "MkBar", structFields = ("foo1",HsType "StructFieldTypeTODO") ::: ("foo2",HsType "StructFieldTypeTODO") ::: VNil}) (\(x1 ::: x2 ::: VNil) -> (Seq (List {getList = [PokeByteOff x0 0 x1, PokeByteOff x0 64 x2]}))))})))]} \ No newline at end of file diff --git a/hs-bindgen/fixtures/primitive_types.hs b/hs-bindgen/fixtures/primitive_types.hs index cd3b361..d1da0bd 100644 --- a/hs-bindgen/fixtures/primitive_types.hs +++ b/hs-bindgen/fixtures/primitive_types.hs @@ -1 +1 @@ -List {getList = [DeclData (WithStruct (Struct {structName = "Primitive", structConstr = "MkPrimitive", structFields = "c" ::: "sc" ::: "uc" ::: "s" ::: "si" ::: "ss" ::: "ssi" ::: "us" ::: "usi" ::: "i" ::: "s2" ::: "si2" ::: "u" ::: "ui" ::: "l" ::: "li" ::: "sl" ::: "sli" ::: "ul" ::: "uli" ::: "ll" ::: "lli" ::: "sll" ::: "slli" ::: "ull" ::: "ulli" ::: "f" ::: "d" ::: "ld" ::: VNil}) (MkDataDecl)), DeclInstance (InstanceStorable (WithStruct (Struct {structName = "Primitive", structConstr = "MkPrimitive", structFields = "c" ::: "sc" ::: "uc" ::: "s" ::: "si" ::: "ss" ::: "ssi" ::: "us" ::: "usi" ::: "i" ::: "s2" ::: "si2" ::: "u" ::: "ui" ::: "l" ::: "li" ::: "sl" ::: "sli" ::: "ul" ::: "uli" ::: "ll" ::: "lli" ::: "sll" ::: "slli" ::: "ull" ::: "ulli" ::: "f" ::: "d" ::: "ld" ::: VNil}) (StorableInstance {storableSizeOf = 176, storableAlignment = 16, storablePeek = Lambda (\x0 -> Ap (IntroStruct (Struct {structName = "Primitive", structConstr = "MkPrimitive", structFields = "c" ::: "sc" ::: "uc" ::: "s" ::: "si" ::: "ss" ::: "ssi" ::: "us" ::: "usi" ::: "i" ::: "s2" ::: "si2" ::: "u" ::: "ui" ::: "l" ::: "li" ::: "sl" ::: "sli" ::: "ul" ::: "uli" ::: "ll" ::: "lli" ::: "sll" ::: "slli" ::: "ull" ::: "ulli" ::: "f" ::: "d" ::: "ld" ::: VNil})) [PeekByteOff x0 0, PeekByteOff x0 8, PeekByteOff x0 16, PeekByteOff x0 32, PeekByteOff x0 48, PeekByteOff x0 64, PeekByteOff x0 80, PeekByteOff x0 96, PeekByteOff x0 112, PeekByteOff x0 128, PeekByteOff x0 160, PeekByteOff x0 192, PeekByteOff x0 224, PeekByteOff x0 256, PeekByteOff x0 320, PeekByteOff x0 384, PeekByteOff x0 448, PeekByteOff x0 512, PeekByteOff x0 576, PeekByteOff x0 640, PeekByteOff x0 704, PeekByteOff x0 768, PeekByteOff x0 832, PeekByteOff x0 896, PeekByteOff x0 960, PeekByteOff x0 1024, PeekByteOff x0 1088, PeekByteOff x0 1152, PeekByteOff x0 1280]), storablePoke = Lambda (\x0 -> ElimStruct (Struct {structName = "Primitive", structConstr = "MkPrimitive", structFields = "c" ::: "sc" ::: "uc" ::: "s" ::: "si" ::: "ss" ::: "ssi" ::: "us" ::: "usi" ::: "i" ::: "s2" ::: "si2" ::: "u" ::: "ui" ::: "l" ::: "li" ::: "sl" ::: "sli" ::: "ul" ::: "uli" ::: "ll" ::: "lli" ::: "sll" ::: "slli" ::: "ull" ::: "ulli" ::: "f" ::: "d" ::: "ld" ::: VNil}) (\(x1 ::: x2 ::: x3 ::: x4 ::: x5 ::: x6 ::: x7 ::: x8 ::: x9 ::: x10 ::: x11 ::: x12 ::: x13 ::: x14 ::: x15 ::: x16 ::: x17 ::: x18 ::: x19 ::: x20 ::: x21 ::: x22 ::: x23 ::: x24 ::: x25 ::: x26 ::: x27 ::: x28 ::: x29 ::: VNil) -> (Seq (List {getList = [PokeByteOff x0 0 x1, PokeByteOff x0 8 x2, PokeByteOff x0 16 x3, PokeByteOff x0 32 x4, PokeByteOff x0 48 x5, PokeByteOff x0 64 x6, PokeByteOff x0 80 x7, PokeByteOff x0 96 x8, PokeByteOff x0 112 x9, PokeByteOff x0 128 x10, PokeByteOff x0 160 x11, PokeByteOff x0 192 x12, PokeByteOff x0 224 x13, PokeByteOff x0 256 x14, PokeByteOff x0 320 x15, PokeByteOff x0 384 x16, PokeByteOff x0 448 x17, PokeByteOff x0 512 x18, PokeByteOff x0 576 x19, PokeByteOff x0 640 x20, PokeByteOff x0 704 x21, PokeByteOff x0 768 x22, PokeByteOff x0 832 x23, PokeByteOff x0 896 x24, PokeByteOff x0 960 x25, PokeByteOff x0 1024 x26, PokeByteOff x0 1088 x27, PokeByteOff x0 1152 x28, PokeByteOff x0 1280 x29]}))))})))]} \ No newline at end of file +List {getList = [DeclData (WithStruct (Struct {structName = "Primitive", structConstr = "MkPrimitive", structFields = ("c",HsType "StructFieldTypeTODO") ::: ("sc",HsType "StructFieldTypeTODO") ::: ("uc",HsType "StructFieldTypeTODO") ::: ("s",HsType "StructFieldTypeTODO") ::: ("si",HsType "StructFieldTypeTODO") ::: ("ss",HsType "StructFieldTypeTODO") ::: ("ssi",HsType "StructFieldTypeTODO") ::: ("us",HsType "StructFieldTypeTODO") ::: ("usi",HsType "StructFieldTypeTODO") ::: ("i",HsType "StructFieldTypeTODO") ::: ("s2",HsType "StructFieldTypeTODO") ::: ("si2",HsType "StructFieldTypeTODO") ::: ("u",HsType "StructFieldTypeTODO") ::: ("ui",HsType "StructFieldTypeTODO") ::: ("l",HsType "StructFieldTypeTODO") ::: ("li",HsType "StructFieldTypeTODO") ::: ("sl",HsType "StructFieldTypeTODO") ::: ("sli",HsType "StructFieldTypeTODO") ::: ("ul",HsType "StructFieldTypeTODO") ::: ("uli",HsType "StructFieldTypeTODO") ::: ("ll",HsType "StructFieldTypeTODO") ::: ("lli",HsType "StructFieldTypeTODO") ::: ("sll",HsType "StructFieldTypeTODO") ::: ("slli",HsType "StructFieldTypeTODO") ::: ("ull",HsType "StructFieldTypeTODO") ::: ("ulli",HsType "StructFieldTypeTODO") ::: ("f",HsType "StructFieldTypeTODO") ::: ("d",HsType "StructFieldTypeTODO") ::: ("ld",HsType "StructFieldTypeTODO") ::: VNil}) (MkDataDecl)), DeclInstance (InstanceStorable (WithStruct (Struct {structName = "Primitive", structConstr = "MkPrimitive", structFields = ("c",HsType "StructFieldTypeTODO") ::: ("sc",HsType "StructFieldTypeTODO") ::: ("uc",HsType "StructFieldTypeTODO") ::: ("s",HsType "StructFieldTypeTODO") ::: ("si",HsType "StructFieldTypeTODO") ::: ("ss",HsType "StructFieldTypeTODO") ::: ("ssi",HsType "StructFieldTypeTODO") ::: ("us",HsType "StructFieldTypeTODO") ::: ("usi",HsType "StructFieldTypeTODO") ::: ("i",HsType "StructFieldTypeTODO") ::: ("s2",HsType "StructFieldTypeTODO") ::: ("si2",HsType "StructFieldTypeTODO") ::: ("u",HsType "StructFieldTypeTODO") ::: ("ui",HsType "StructFieldTypeTODO") ::: ("l",HsType "StructFieldTypeTODO") ::: ("li",HsType "StructFieldTypeTODO") ::: ("sl",HsType "StructFieldTypeTODO") ::: ("sli",HsType "StructFieldTypeTODO") ::: ("ul",HsType "StructFieldTypeTODO") ::: ("uli",HsType "StructFieldTypeTODO") ::: ("ll",HsType "StructFieldTypeTODO") ::: ("lli",HsType "StructFieldTypeTODO") ::: ("sll",HsType "StructFieldTypeTODO") ::: ("slli",HsType "StructFieldTypeTODO") ::: ("ull",HsType "StructFieldTypeTODO") ::: ("ulli",HsType "StructFieldTypeTODO") ::: ("f",HsType "StructFieldTypeTODO") ::: ("d",HsType "StructFieldTypeTODO") ::: ("ld",HsType "StructFieldTypeTODO") ::: VNil}) (StorableInstance {storableSizeOf = 176, storableAlignment = 16, storablePeek = Lambda (\x0 -> Ap (IntroStruct (Struct {structName = "Primitive", structConstr = "MkPrimitive", structFields = ("c",HsType "StructFieldTypeTODO") ::: ("sc",HsType "StructFieldTypeTODO") ::: ("uc",HsType "StructFieldTypeTODO") ::: ("s",HsType "StructFieldTypeTODO") ::: ("si",HsType "StructFieldTypeTODO") ::: ("ss",HsType "StructFieldTypeTODO") ::: ("ssi",HsType "StructFieldTypeTODO") ::: ("us",HsType "StructFieldTypeTODO") ::: ("usi",HsType "StructFieldTypeTODO") ::: ("i",HsType "StructFieldTypeTODO") ::: ("s2",HsType "StructFieldTypeTODO") ::: ("si2",HsType "StructFieldTypeTODO") ::: ("u",HsType "StructFieldTypeTODO") ::: ("ui",HsType "StructFieldTypeTODO") ::: ("l",HsType "StructFieldTypeTODO") ::: ("li",HsType "StructFieldTypeTODO") ::: ("sl",HsType "StructFieldTypeTODO") ::: ("sli",HsType "StructFieldTypeTODO") ::: ("ul",HsType "StructFieldTypeTODO") ::: ("uli",HsType "StructFieldTypeTODO") ::: ("ll",HsType "StructFieldTypeTODO") ::: ("lli",HsType "StructFieldTypeTODO") ::: ("sll",HsType "StructFieldTypeTODO") ::: ("slli",HsType "StructFieldTypeTODO") ::: ("ull",HsType "StructFieldTypeTODO") ::: ("ulli",HsType "StructFieldTypeTODO") ::: ("f",HsType "StructFieldTypeTODO") ::: ("d",HsType "StructFieldTypeTODO") ::: ("ld",HsType "StructFieldTypeTODO") ::: VNil})) [PeekByteOff x0 0, PeekByteOff x0 8, PeekByteOff x0 16, PeekByteOff x0 32, PeekByteOff x0 48, PeekByteOff x0 64, PeekByteOff x0 80, PeekByteOff x0 96, PeekByteOff x0 112, PeekByteOff x0 128, PeekByteOff x0 160, PeekByteOff x0 192, PeekByteOff x0 224, PeekByteOff x0 256, PeekByteOff x0 320, PeekByteOff x0 384, PeekByteOff x0 448, PeekByteOff x0 512, PeekByteOff x0 576, PeekByteOff x0 640, PeekByteOff x0 704, PeekByteOff x0 768, PeekByteOff x0 832, PeekByteOff x0 896, PeekByteOff x0 960, PeekByteOff x0 1024, PeekByteOff x0 1088, PeekByteOff x0 1152, PeekByteOff x0 1280]), storablePoke = Lambda (\x0 -> ElimStruct (Struct {structName = "Primitive", structConstr = "MkPrimitive", structFields = ("c",HsType "StructFieldTypeTODO") ::: ("sc",HsType "StructFieldTypeTODO") ::: ("uc",HsType "StructFieldTypeTODO") ::: ("s",HsType "StructFieldTypeTODO") ::: ("si",HsType "StructFieldTypeTODO") ::: ("ss",HsType "StructFieldTypeTODO") ::: ("ssi",HsType "StructFieldTypeTODO") ::: ("us",HsType "StructFieldTypeTODO") ::: ("usi",HsType "StructFieldTypeTODO") ::: ("i",HsType "StructFieldTypeTODO") ::: ("s2",HsType "StructFieldTypeTODO") ::: ("si2",HsType "StructFieldTypeTODO") ::: ("u",HsType "StructFieldTypeTODO") ::: ("ui",HsType "StructFieldTypeTODO") ::: ("l",HsType "StructFieldTypeTODO") ::: ("li",HsType "StructFieldTypeTODO") ::: ("sl",HsType "StructFieldTypeTODO") ::: ("sli",HsType "StructFieldTypeTODO") ::: ("ul",HsType "StructFieldTypeTODO") ::: ("uli",HsType "StructFieldTypeTODO") ::: ("ll",HsType "StructFieldTypeTODO") ::: ("lli",HsType "StructFieldTypeTODO") ::: ("sll",HsType "StructFieldTypeTODO") ::: ("slli",HsType "StructFieldTypeTODO") ::: ("ull",HsType "StructFieldTypeTODO") ::: ("ulli",HsType "StructFieldTypeTODO") ::: ("f",HsType "StructFieldTypeTODO") ::: ("d",HsType "StructFieldTypeTODO") ::: ("ld",HsType "StructFieldTypeTODO") ::: VNil}) (\(x1 ::: x2 ::: x3 ::: x4 ::: x5 ::: x6 ::: x7 ::: x8 ::: x9 ::: x10 ::: x11 ::: x12 ::: x13 ::: x14 ::: x15 ::: x16 ::: x17 ::: x18 ::: x19 ::: x20 ::: x21 ::: x22 ::: x23 ::: x24 ::: x25 ::: x26 ::: x27 ::: x28 ::: x29 ::: VNil) -> (Seq (List {getList = [PokeByteOff x0 0 x1, PokeByteOff x0 8 x2, PokeByteOff x0 16 x3, PokeByteOff x0 32 x4, PokeByteOff x0 48 x5, PokeByteOff x0 64 x6, PokeByteOff x0 80 x7, PokeByteOff x0 96 x8, PokeByteOff x0 112 x9, PokeByteOff x0 128 x10, PokeByteOff x0 160 x11, PokeByteOff x0 192 x12, PokeByteOff x0 224 x13, PokeByteOff x0 256 x14, PokeByteOff x0 320 x15, PokeByteOff x0 384 x16, PokeByteOff x0 448 x17, PokeByteOff x0 512 x18, PokeByteOff x0 576 x19, PokeByteOff x0 640 x20, PokeByteOff x0 704 x21, PokeByteOff x0 768 x22, PokeByteOff x0 832 x23, PokeByteOff x0 896 x24, PokeByteOff x0 960 x25, PokeByteOff x0 1024 x26, PokeByteOff x0 1088 x27, PokeByteOff x0 1152 x28, PokeByteOff x0 1280 x29]}))))})))]} \ No newline at end of file diff --git a/hs-bindgen/fixtures/simple_structs.hs b/hs-bindgen/fixtures/simple_structs.hs index e688673..9104333 100644 --- a/hs-bindgen/fixtures/simple_structs.hs +++ b/hs-bindgen/fixtures/simple_structs.hs @@ -1 +1 @@ -List {getList = [DeclData (WithStruct (Struct {structName = "S1", structConstr = "MkS1", structFields = "a" ::: "b" ::: VNil}) (MkDataDecl)), DeclInstance (InstanceStorable (WithStruct (Struct {structName = "S1", structConstr = "MkS1", structFields = "a" ::: "b" ::: VNil}) (StorableInstance {storableSizeOf = 8, storableAlignment = 4, storablePeek = Lambda (\x0 -> Ap (IntroStruct (Struct {structName = "S1", structConstr = "MkS1", structFields = "a" ::: "b" ::: VNil})) [PeekByteOff x0 0, PeekByteOff x0 32]), storablePoke = Lambda (\x0 -> ElimStruct (Struct {structName = "S1", structConstr = "MkS1", structFields = "a" ::: "b" ::: VNil}) (\(x1 ::: x2 ::: VNil) -> (Seq (List {getList = [PokeByteOff x0 0 x1, PokeByteOff x0 32 x2]}))))}))), DeclData (WithStruct (Struct {structName = "S2", structConstr = "MkS2", structFields = "a" ::: "b" ::: "c" ::: VNil}) (MkDataDecl)), DeclInstance (InstanceStorable (WithStruct (Struct {structName = "S2", structConstr = "MkS2", structFields = "a" ::: "b" ::: "c" ::: VNil}) (StorableInstance {storableSizeOf = 12, storableAlignment = 4, storablePeek = Lambda (\x0 -> Ap (IntroStruct (Struct {structName = "S2", structConstr = "MkS2", structFields = "a" ::: "b" ::: "c" ::: VNil})) [PeekByteOff x0 0, PeekByteOff x0 32, PeekByteOff x0 64]), storablePoke = Lambda (\x0 -> ElimStruct (Struct {structName = "S2", structConstr = "MkS2", structFields = "a" ::: "b" ::: "c" ::: VNil}) (\(x1 ::: x2 ::: x3 ::: VNil) -> (Seq (List {getList = [PokeByteOff x0 0 x1, PokeByteOff x0 32 x2, PokeByteOff x0 64 x3]}))))}))), DeclData (WithStruct (Struct {structName = "X", structConstr = "MkX", structFields = "a" ::: VNil}) (MkDataDecl)), DeclInstance (InstanceStorable (WithStruct (Struct {structName = "X", structConstr = "MkX", structFields = "a" ::: VNil}) (StorableInstance {storableSizeOf = 1, storableAlignment = 1, storablePeek = Lambda (\x0 -> Ap (IntroStruct (Struct {structName = "X", structConstr = "MkX", structFields = "a" ::: VNil})) [PeekByteOff x0 0]), storablePoke = Lambda (\x0 -> ElimStruct (Struct {structName = "X", structConstr = "MkX", structFields = "a" ::: VNil}) (\(x1 ::: VNil) -> (Seq (List {getList = [PokeByteOff x0 0 x1]}))))}))), DeclData (WithStruct (Struct {structName = "S4", structConstr = "MkS4", structFields = "b" ::: "a" ::: VNil}) (MkDataDecl)), DeclInstance (InstanceStorable (WithStruct (Struct {structName = "S4", structConstr = "MkS4", structFields = "b" ::: "a" ::: VNil}) (StorableInstance {storableSizeOf = 8, storableAlignment = 4, storablePeek = Lambda (\x0 -> Ap (IntroStruct (Struct {structName = "S4", structConstr = "MkS4", structFields = "b" ::: "a" ::: VNil})) [PeekByteOff x0 0, PeekByteOff x0 32]), storablePoke = Lambda (\x0 -> ElimStruct (Struct {structName = "S4", structConstr = "MkS4", structFields = "b" ::: "a" ::: VNil}) (\(x1 ::: x2 ::: VNil) -> (Seq (List {getList = [PokeByteOff x0 0 x1, PokeByteOff x0 32 x2]}))))})))]} \ No newline at end of file +List {getList = [DeclData (WithStruct (Struct {structName = "S1", structConstr = "MkS1", structFields = ("a",HsType "StructFieldTypeTODO") ::: ("b",HsType "StructFieldTypeTODO") ::: VNil}) (MkDataDecl)), DeclInstance (InstanceStorable (WithStruct (Struct {structName = "S1", structConstr = "MkS1", structFields = ("a",HsType "StructFieldTypeTODO") ::: ("b",HsType "StructFieldTypeTODO") ::: VNil}) (StorableInstance {storableSizeOf = 8, storableAlignment = 4, storablePeek = Lambda (\x0 -> Ap (IntroStruct (Struct {structName = "S1", structConstr = "MkS1", structFields = ("a",HsType "StructFieldTypeTODO") ::: ("b",HsType "StructFieldTypeTODO") ::: VNil})) [PeekByteOff x0 0, PeekByteOff x0 32]), storablePoke = Lambda (\x0 -> ElimStruct (Struct {structName = "S1", structConstr = "MkS1", structFields = ("a",HsType "StructFieldTypeTODO") ::: ("b",HsType "StructFieldTypeTODO") ::: VNil}) (\(x1 ::: x2 ::: VNil) -> (Seq (List {getList = [PokeByteOff x0 0 x1, PokeByteOff x0 32 x2]}))))}))), DeclData (WithStruct (Struct {structName = "S2", structConstr = "MkS2", structFields = ("a",HsType "StructFieldTypeTODO") ::: ("b",HsType "StructFieldTypeTODO") ::: ("c",HsType "StructFieldTypeTODO") ::: VNil}) (MkDataDecl)), DeclInstance (InstanceStorable (WithStruct (Struct {structName = "S2", structConstr = "MkS2", structFields = ("a",HsType "StructFieldTypeTODO") ::: ("b",HsType "StructFieldTypeTODO") ::: ("c",HsType "StructFieldTypeTODO") ::: VNil}) (StorableInstance {storableSizeOf = 12, storableAlignment = 4, storablePeek = Lambda (\x0 -> Ap (IntroStruct (Struct {structName = "S2", structConstr = "MkS2", structFields = ("a",HsType "StructFieldTypeTODO") ::: ("b",HsType "StructFieldTypeTODO") ::: ("c",HsType "StructFieldTypeTODO") ::: VNil})) [PeekByteOff x0 0, PeekByteOff x0 32, PeekByteOff x0 64]), storablePoke = Lambda (\x0 -> ElimStruct (Struct {structName = "S2", structConstr = "MkS2", structFields = ("a",HsType "StructFieldTypeTODO") ::: ("b",HsType "StructFieldTypeTODO") ::: ("c",HsType "StructFieldTypeTODO") ::: VNil}) (\(x1 ::: x2 ::: x3 ::: VNil) -> (Seq (List {getList = [PokeByteOff x0 0 x1, PokeByteOff x0 32 x2, PokeByteOff x0 64 x3]}))))}))), DeclData (WithStruct (Struct {structName = "X", structConstr = "MkX", structFields = ("a",HsType "StructFieldTypeTODO") ::: VNil}) (MkDataDecl)), DeclInstance (InstanceStorable (WithStruct (Struct {structName = "X", structConstr = "MkX", structFields = ("a",HsType "StructFieldTypeTODO") ::: VNil}) (StorableInstance {storableSizeOf = 1, storableAlignment = 1, storablePeek = Lambda (\x0 -> Ap (IntroStruct (Struct {structName = "X", structConstr = "MkX", structFields = ("a",HsType "StructFieldTypeTODO") ::: VNil})) [PeekByteOff x0 0]), storablePoke = Lambda (\x0 -> ElimStruct (Struct {structName = "X", structConstr = "MkX", structFields = ("a",HsType "StructFieldTypeTODO") ::: VNil}) (\(x1 ::: VNil) -> (Seq (List {getList = [PokeByteOff x0 0 x1]}))))}))), DeclData (WithStruct (Struct {structName = "S4", structConstr = "MkS4", structFields = ("b",HsType "StructFieldTypeTODO") ::: ("a",HsType "StructFieldTypeTODO") ::: VNil}) (MkDataDecl)), DeclInstance (InstanceStorable (WithStruct (Struct {structName = "S4", structConstr = "MkS4", structFields = ("b",HsType "StructFieldTypeTODO") ::: ("a",HsType "StructFieldTypeTODO") ::: VNil}) (StorableInstance {storableSizeOf = 8, storableAlignment = 4, storablePeek = Lambda (\x0 -> Ap (IntroStruct (Struct {structName = "S4", structConstr = "MkS4", structFields = ("b",HsType "StructFieldTypeTODO") ::: ("a",HsType "StructFieldTypeTODO") ::: VNil})) [PeekByteOff x0 0, PeekByteOff x0 32]), storablePoke = Lambda (\x0 -> ElimStruct (Struct {structName = "S4", structConstr = "MkS4", structFields = ("b",HsType "StructFieldTypeTODO") ::: ("a",HsType "StructFieldTypeTODO") ::: VNil}) (\(x1 ::: x2 ::: VNil) -> (Seq (List {getList = [PokeByteOff x0 0 x1, PokeByteOff x0 32 x2]}))))})))]} \ No newline at end of file diff --git a/hs-bindgen/fixtures/typedef_vs_macro.hs b/hs-bindgen/fixtures/typedef_vs_macro.hs index 4a37a92..79f7eee 100644 --- a/hs-bindgen/fixtures/typedef_vs_macro.hs +++ b/hs-bindgen/fixtures/typedef_vs_macro.hs @@ -1 +1 @@ -List {getList = [DeclData (WithStruct (Struct {structName = "ExampleStruct", structConstr = "MkExampleStruct", structFields = "t1" ::: "t2" ::: "m1" ::: "m2" ::: VNil}) (MkDataDecl)), DeclInstance (InstanceStorable (WithStruct (Struct {structName = "ExampleStruct", structConstr = "MkExampleStruct", structFields = "t1" ::: "t2" ::: "m1" ::: "m2" ::: VNil}) (StorableInstance {storableSizeOf = 16, storableAlignment = 4, storablePeek = Lambda (\x0 -> Ap (IntroStruct (Struct {structName = "ExampleStruct", structConstr = "MkExampleStruct", structFields = "t1" ::: "t2" ::: "m1" ::: "m2" ::: VNil})) [PeekByteOff x0 0, PeekByteOff x0 32, PeekByteOff x0 64, PeekByteOff x0 96]), storablePoke = Lambda (\x0 -> ElimStruct (Struct {structName = "ExampleStruct", structConstr = "MkExampleStruct", structFields = "t1" ::: "t2" ::: "m1" ::: "m2" ::: VNil}) (\(x1 ::: x2 ::: x3 ::: x4 ::: VNil) -> (Seq (List {getList = [PokeByteOff x0 0 x1, PokeByteOff x0 32 x2, PokeByteOff x0 64 x3, PokeByteOff x0 96 x4]}))))})))]} \ No newline at end of file +List {getList = [DeclData (WithStruct (Struct {structName = "ExampleStruct", structConstr = "MkExampleStruct", structFields = ("t1",HsType "StructFieldTypeTODO") ::: ("t2",HsType "StructFieldTypeTODO") ::: ("m1",HsType "StructFieldTypeTODO") ::: ("m2",HsType "StructFieldTypeTODO") ::: VNil}) (MkDataDecl)), DeclInstance (InstanceStorable (WithStruct (Struct {structName = "ExampleStruct", structConstr = "MkExampleStruct", structFields = ("t1",HsType "StructFieldTypeTODO") ::: ("t2",HsType "StructFieldTypeTODO") ::: ("m1",HsType "StructFieldTypeTODO") ::: ("m2",HsType "StructFieldTypeTODO") ::: VNil}) (StorableInstance {storableSizeOf = 16, storableAlignment = 4, storablePeek = Lambda (\x0 -> Ap (IntroStruct (Struct {structName = "ExampleStruct", structConstr = "MkExampleStruct", structFields = ("t1",HsType "StructFieldTypeTODO") ::: ("t2",HsType "StructFieldTypeTODO") ::: ("m1",HsType "StructFieldTypeTODO") ::: ("m2",HsType "StructFieldTypeTODO") ::: VNil})) [PeekByteOff x0 0, PeekByteOff x0 32, PeekByteOff x0 64, PeekByteOff x0 96]), storablePoke = Lambda (\x0 -> ElimStruct (Struct {structName = "ExampleStruct", structConstr = "MkExampleStruct", structFields = ("t1",HsType "StructFieldTypeTODO") ::: ("t2",HsType "StructFieldTypeTODO") ::: ("m1",HsType "StructFieldTypeTODO") ::: ("m2",HsType "StructFieldTypeTODO") ::: VNil}) (\(x1 ::: x2 ::: x3 ::: x4 ::: VNil) -> (Seq (List {getList = [PokeByteOff x0 0 x1, PokeByteOff x0 32 x2, PokeByteOff x0 64 x3, PokeByteOff x0 96 x4]}))))})))]} \ No newline at end of file diff --git a/hs-bindgen/fixtures/uses_utf8.hs b/hs-bindgen/fixtures/uses_utf8.hs index 8e6fb29..030197f 100644 --- a/hs-bindgen/fixtures/uses_utf8.hs +++ b/hs-bindgen/fixtures/uses_utf8.hs @@ -1 +1 @@ -List {getList = [DeclInstance (InstanceStorable (WithStruct (Struct {structName = "MyEnum", structConstr = "MkMyEnum", structFields = "unmyEnum" ::: VNil}) (StorableInstance {storableSizeOf = 4, storableAlignment = 4, storablePeek = Lambda (\x0 -> Ap (IntroStruct (Struct {structName = "MyEnum", structConstr = "MkMyEnum", structFields = "unmyEnum" ::: VNil})) [PeekByteOff x0 0]), storablePoke = Lambda (\x0 -> ElimStruct (Struct {structName = "MyEnum", structConstr = "MkMyEnum", structFields = "unmyEnum" ::: VNil}) (\(x1 ::: VNil) -> (Seq (List {getList = [PokeByteOff x0 0 x1]}))))})))]} \ No newline at end of file +List {getList = [DeclInstance (InstanceStorable (WithStruct (Struct {structName = "MyEnum", structConstr = "MkMyEnum", structFields = ("unmyEnum",HsType "EnumTypeTODO") ::: VNil}) (StorableInstance {storableSizeOf = 4, storableAlignment = 4, storablePeek = Lambda (\x0 -> Ap (IntroStruct (Struct {structName = "MyEnum", structConstr = "MkMyEnum", structFields = ("unmyEnum",HsType "EnumTypeTODO") ::: VNil})) [PeekByteOff x0 0]), storablePoke = Lambda (\x0 -> ElimStruct (Struct {structName = "MyEnum", structConstr = "MkMyEnum", structFields = ("unmyEnum",HsType "EnumTypeTODO") ::: VNil}) (\(x1 ::: VNil) -> (Seq (List {getList = [PokeByteOff x0 0 x1]}))))})))]} \ No newline at end of file diff --git a/hs-bindgen/src/HsBindgen/Backend/Common/Translation.hs b/hs-bindgen/src/HsBindgen/Backend/Common/Translation.hs index 492469c..adfee9d 100644 --- a/hs-bindgen/src/HsBindgen/Backend/Common/Translation.hs +++ b/hs-bindgen/src/HsBindgen/Backend/Common/Translation.hs @@ -54,6 +54,7 @@ instance Backend be => ToBE be (Hs.WithStruct Hs.DataDecl) where toBE _be (Hs.WithStruct struct Hs.MkDataDecl) = do return $ DData $ Data $ Hs.structName struct + {------------------------------------------------------------------------------- 'Storable' -------------------------------------------------------------------------------} @@ -105,12 +106,15 @@ instance Backend be => ToBE be (Hs.IntroStruct n) where instance DefToBE be a => ToBE be (Hs.ElimStruct n a) where toBE be (Hs.ElimStruct struct k) = - fresh be "x" $ \x -> - freshVec be (Hs.structFields struct) $ \fs -> do + fresh be "x" $ \x -> + freshVec be fieldNames $ \fs -> do k' <- toBE be (k fs) return $ mkExpr be $ ELam (Just x) $ ECase (EVar x) [ (Hs.structConstr struct, toList fs, EInj k') ] + where + fieldNames :: Vec n (HsName NsVar) + fieldNames = fst <$> Hs.structFields struct {------------------------------------------------------------------------------- Internal auxiliary: derived functionality diff --git a/hs-bindgen/src/HsBindgen/Hs/AST.hs b/hs-bindgen/src/HsBindgen/Hs/AST.hs index bc341df..7319cad 100644 --- a/hs-bindgen/src/HsBindgen/Hs/AST.hs +++ b/hs-bindgen/src/HsBindgen/Hs/AST.hs @@ -20,6 +20,8 @@ module HsBindgen.Hs.AST ( -- * Information about generated code Struct(..) + -- * Types + , HsType(..) -- * Variable binding , Lambda(..) , Ap(..) @@ -56,11 +58,19 @@ import HsBindgen.Util.PHOAS data Struct (n :: Nat) = Struct { structName :: HsName NsTypeConstr , structConstr :: HsName NsConstr - , structFields :: Vec n (HsName NsVar) + , structFields :: Vec n (HsName NsVar, HsType) } deriving stock instance Show (Struct n) +{------------------------------------------------------------------------------- + Types +-------------------------------------------------------------------------------} + +data HsType = + HsType String + deriving stock (Show) + {------------------------------------------------------------------------------- Variable binding -------------------------------------------------------------------------------} diff --git a/hs-bindgen/src/HsBindgen/Translation/LowLevel.hs b/hs-bindgen/src/HsBindgen/Translation/LowLevel.hs index 17bcc19..4d3ec5c 100644 --- a/hs-bindgen/src/HsBindgen/Translation/LowLevel.hs +++ b/hs-bindgen/src/HsBindgen/Translation/LowLevel.hs @@ -80,9 +80,12 @@ structDecs struct fields = List hs = Hs.Struct { structName = fromMaybe "X" (toHsName <$> C.structTag struct) , structConstr = maybe "MkX" ("Mk" <>) (toHsName <$> C.structTag struct) - , structFields = Vec.map (toHsName . C.fieldName) fields + , structFields = Vec.map mkField fields } + mkField :: C.StructField -> (HsName NsVar, Hs.HsType) + mkField f = (toHsName (C.fieldName f), Hs.HsType "StructFieldTypeTODO") + storable :: Hs.WithStruct Hs.StorableInstance f storable = Hs.WithStruct hs $ Hs.StorableInstance { Hs.storableSizeOf = C.structSizeof struct @@ -115,8 +118,10 @@ enumDecs e = List [ hs = Hs.Struct { structName = fromMaybe "X" (toHsName <$> C.enumTag e) , structConstr = maybe "MkX" ("Mk" <>) (toHsName <$> C.enumTag e) - , structFields = Vec.singleton $ - maybe "unX" ("un" <>) (toHsName <$> C.enumTag e) + , structFields = Vec.singleton + ( maybe "unX" ("un" <>) (toHsName <$> C.enumTag e) + , Hs.HsType "EnumTypeTODO" + ) } storable :: Hs.WithStruct Hs.StorableInstance f diff --git a/hs-bindgen/test-th/HsBindgen/TestTH/Examples.hs b/hs-bindgen/test-th/HsBindgen/TestTH/Examples.hs index 7b62540..fc56a39 100644 --- a/hs-bindgen/test-th/HsBindgen/TestTH/Examples.hs +++ b/hs-bindgen/test-th/HsBindgen/TestTH/Examples.hs @@ -38,7 +38,7 @@ myStruct :: Hs.Struct ('S ('S 'Z)) myStruct = Hs.Struct { structName = "MyStruct" , structConstr = "MkMyStruct" - , structFields = "myStructField1" ::: "myStructField2" ::: VNil + , structFields = ("myStructField1", Hs.HsType "Int") ::: ("myStructField2", Hs.HsType "Char") ::: VNil } myStructStorableInstance :: Hs.WithStruct Hs.StorableInstance f