Skip to content

Commit

Permalink
Merge pull request #226 from well-typed/struct-field-types
Browse files Browse the repository at this point in the history
Add placeholder for struct field types
  • Loading branch information
edsko authored Oct 17, 2024
2 parents 9eca232 + efcb1ff commit 85de9eb
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 14 deletions.
2 changes: 1 addition & 1 deletion hs-bindgen/fixtures/enums.hs
Original file line number Diff line number Diff line change
@@ -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]}))))})))]}
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]}))))})))]}
2 changes: 1 addition & 1 deletion hs-bindgen/fixtures/fixedwidth.hs
Original file line number Diff line number Diff line change
@@ -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]}))))})))]}
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]}))))})))]}
2 changes: 1 addition & 1 deletion hs-bindgen/fixtures/nested_types.hs
Original file line number Diff line number Diff line change
@@ -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]}))))})))]}
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]}))))})))]}
Loading

0 comments on commit 85de9eb

Please sign in to comment.