Skip to content

Commit a5a3f21

Browse files
authored
Describe all the wire types (#4)
1 parent 57391cc commit a5a3f21

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1211
-3412
lines changed

.github/workflows/workflow.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,5 @@ jobs:
2020
ghc-version: ${{ matrix.ghc }}
2121
cabal-version: ${{ matrix.cabal }}
2222

23-
- run: cabal build --only-dependencies -j2
24-
- run: cabal install hspec-discover
23+
- run: cabal build --enable-tests --only-dependencies -j2
2524
- run: cabal test

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,27 @@
22

33
[![Hackage](https://img.shields.io/hackage/v/aeson-tiled.svg)](https://hackage.haskell.org/package/aeson-tiled)
44

5-
Types and instances for [Tiled](https://www.mapeditor.org/) map editor `.tmj` files.
5+
Types and instances for [Tiled](https://www.mapeditor.org/) map editor map/`.tmj` and tileset/`.tsj` files.
66

77
> `aeson-tiled` is the spiritual successor to `htiled`.
88
> `htiled` uses `hxt` which relies too heavily on Arrows and is rather hard to work with.
99
> Tiled's json export supports 100% of Tiled's features, so there doesn't seem to be much of a point to maintaining a large Arrows-based project when writing Aeson instances for Tiled types is much easier.
1010
> Hence this project!
11+
12+
The package is geared toward minimal divergence from Tiled type specifications.
13+
14+
Tiled data format is taken at version 1.8.4.
15+
Should be compatible down to 1.6 (where the `version` field changed to string).
16+
17+
GHC versions are supported from 8.10 and follow Stackage LTS + Stackage Nightly + whatever is available on `ghcup`.
18+
19+
## Module structure
20+
21+
The modules are designed for qualified imports and `OverloadedRecordDot` extension.
22+
Everyone has a `Generic` instance so you can use `generic-lens` or `generic-optics` if you wish.
23+
24+
- Modules under `Codec.Tiled.*` are concerned with `aeson` representation, one type at a time.
25+
They provide JSON `Value` translation to concrete types, but not much beyond that.
26+
Your application most likely should use its own representation.
27+
- Modules under `Data.Tiled.*` are types specific to this package.
28+
They are more refined and may be utilized directly.

aeson-tiled.cabal

Lines changed: 97 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,79 @@
1-
name: aeson-tiled
2-
version: 0.0.1.0
3-
synopsis: Aeson instances for the Tiled map editor.
4-
description: The mighty Tiled 2D map editor is an open source
5-
app for creating tile based level maps. This package provides
6-
types and aeson instances to read Tiled json files.
7-
homepage: https://github.com/haskell-game/aeson-tiled
8-
license: BSD3
9-
license-file: LICENSE
10-
maintainer: [email protected]
11-
author: Schell Scivally
12-
copyright: (c) 2017 Schell Scivally
13-
category: Game Engine
14-
build-type: Simple
15-
cabal-version: >=1.10
1+
cabal-version: 3.0
2+
name: aeson-tiled
3+
version: 0.0.2.0
4+
synopsis: Aeson instances for the Tiled map editor.
5+
description:
6+
The mighty Tiled 2D map editor is an open source
7+
app for creating tile based level maps. This package provides
8+
types and aeson instances to read Tiled json files.
9+
homepage: https://github.com/haskell-game/aeson-tiled
10+
license: BSD-3-Clause
11+
license-file: LICENSE
12+
maintainer: [email protected]
13+
author: Schell Scivally
14+
copyright: (c) 2017 Schell Scivally
15+
category: Game Engine
16+
build-type: Simple
1617

1718
extra-source-files:
1819
README.md,
19-
ChangeLog.md
20+
ChangeLog.md,
21+
maps/microgue/*.tmj,
22+
maps/microgue/*.tsj
2023

2124
library
22-
hs-source-dirs: src
23-
exposed-modules: Data.Aeson.Tiled
24-
build-depends: base >= 4.7 && < 5
25-
, bytestring >= 0.10 && < 1
26-
, aeson >= 1.0 && < 3
27-
, containers >= 0.5 && < 1
28-
, text >= 1.2 && < 3
29-
, vector >= 0.11 && < 1
30-
default-language: Haskell2010
25+
hs-source-dirs: src
26+
exposed-modules:
27+
Codec.Tiled
28+
Codec.Tiled.Aeson
29+
Codec.Tiled.Layer
30+
Codec.Tiled.Layer.Chunk
31+
Codec.Tiled.Layer.Data
32+
Codec.Tiled.Map
33+
Codec.Tiled.Map.IO
34+
Codec.Tiled.Object
35+
Codec.Tiled.Object.Point
36+
Codec.Tiled.Object.Template
37+
Codec.Tiled.Object.Template.IO
38+
Codec.Tiled.Object.Text
39+
Codec.Tiled.Property
40+
Codec.Tiled.Tileset
41+
Codec.Tiled.Tileset.Frame
42+
Codec.Tiled.Tileset.Grid
43+
Codec.Tiled.Tileset.IO
44+
Codec.Tiled.Tileset.Ref
45+
Codec.Tiled.Tileset.Terrain
46+
Codec.Tiled.Tileset.Tile
47+
Codec.Tiled.Tileset.TileOffset
48+
Codec.Tiled.Tileset.Transformations
49+
Codec.Tiled.Tileset.WangColor
50+
Codec.Tiled.Tileset.WangSet
51+
Codec.Tiled.Tileset.WangTile
52+
Codec.Tiled.World
53+
Codec.Tiled.World.Map
54+
Codec.Tiled.World.Pattern
55+
Data.Tiled.GID
56+
build-depends:
57+
base >= 4.7 && < 5
58+
, bytestring >= 0.10 && < 1
59+
, aeson >= 1.0 && < 3
60+
, containers >= 0.5 && < 1
61+
, text >= 1.2 && < 3
62+
, vector >= 0.11 && < 1
63+
default-language:
64+
Haskell2010
65+
default-extensions:
66+
BlockArguments,
67+
DeriveGeneric,
68+
DerivingStrategies,
69+
FlexibleContexts,
70+
GeneralizedNewtypeDeriving,
71+
ImportQualifiedPost,
72+
LambdaCase,
73+
OverloadedStrings,
74+
PatternSynonyms,
75+
RecordWildCards,
76+
StrictData,
3177

3278
flag tests
3379
manual: True
@@ -36,17 +82,29 @@ flag tests
3682
test-suite aeson-tiled-test
3783
if !flag(tests)
3884
buildable: False
39-
type: exitcode-stdio-1.0
40-
hs-source-dirs: test
41-
main-is: Spec.hs
42-
build-depends: base
43-
, aeson >= 1.1
44-
, aeson-tiled
45-
, hspec
46-
, hspec-discover
47-
, bytestring
48-
ghc-options: -threaded -rtsopts -with-rtsopts=-N
49-
default-language: Haskell2010
50-
other-modules:
51-
ParseObjectSpec
52-
RoundTripSpec
85+
type: exitcode-stdio-1.0
86+
hs-source-dirs: tests
87+
main-is: Main.hs
88+
build-depends:
89+
aeson-tiled,
90+
base,
91+
filepath,
92+
tasty-hunit,
93+
tasty,
94+
temporary
95+
96+
ghc-options: -threaded -rtsopts -with-rtsopts=-N
97+
default-language:
98+
Haskell2010
99+
default-extensions:
100+
BlockArguments,
101+
DeriveGeneric,
102+
DerivingStrategies,
103+
FlexibleContexts,
104+
GeneralizedNewtypeDeriving,
105+
ImportQualifiedPost,
106+
LambdaCase,
107+
OverloadedStrings,
108+
PatternSynonyms,
109+
RecordWildCards,
110+
StrictData,

app/Main.hs

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)