name: inverse layout: true class: center, middle, inverse --- layout: false class: middle, inverse ### #
[hpack](https://github.com/sol/hpack)
##
An alternative format for Haskell packages
### ###
by Simon Hengel
--- layout: false class: middle, inverse ### Before we start: #
[Competition is]() a [good]() thing!
## ### ### --- layout: false class: middle, inverse ### #
<tinc>
## ### ### --- ## [hpack](https://github.com/sol/hpack): An alternative format for Haskell packages - #### Is based on [YAML](http://yaml.org/) - #### Generates Cabal files - #### [Infers]() module names - #### Removes redundancy (GHC options, dependencies, etc.) - #### Provides some sugarcoating - #### Gives [you]() 100% control --- layout: false class: middle, inverse ### #
demo
## ### ### --- ## [hpack](https://github.com/sol/hpack): Generates Cabal files ``` $ tree . ├── package.yaml └── src └── Foo.hs ``` ``` $ cat package.yaml --- name: foo version: 0.1.0 library: source-dirs: src ``` ``` $ hpack && cat foo.cabal name: foo version: 0.1.0 build-type: Simple cabal-version: >= 1.10 library hs-source-dirs: src exposed-modules: Foo default-language: Haskell2010 ``` --- ## [hpack](https://github.com/sol/hpack): Infers module names ``` $ tree src/ src/ ├── Foo.hs ├── Bar.hs └── Baz.hs ``` ``` $ cat package.yaml --- library: source-dirs: src ``` ``` $ cat foo.cabal name: foo version: 0.0.0 build-type: Simple cabal-version: >= 1.10 library hs-source-dirs: src exposed-modules: Foo Bar Baz default-language: Haskell2010 ``` --- ## [hpack](https://github.com/sol/hpack): Infers module names ``` $ cat package.yaml --- library: source-dirs: src exposed-modules: Foo ``` ``` $ cat foo.cabal name: foo version: 0.0.0 build-type: Simple cabal-version: >= 1.10 library hs-source-dirs: src exposed-modules: Foo other-modules: Bar Baz default-language: Haskell2010 ``` --- ## [hpack](https://github.com/sol/hpack): Infers module names ``` $ cat package.yaml --- library: source-dirs: src other-modules: Baz ``` ``` $ cat foo.cabal name: foo version: 0.0.0 build-type: Simple cabal-version: >= 1.10 library hs-source-dirs: src exposed-modules: Foo Bar other-modules: Baz default-language: Haskell2010 ``` --- ## [hpack](https://github.com/sol/hpack): Gives you 100% control ``` $ cat package.yaml --- library: source-dirs: src exposed-modules: - Foo other-modules: - Bar ``` ``` $ cat foo.cabal name: foo version: 0.0.0 build-type: Simple cabal-version: >= 1.10 library hs-source-dirs: src exposed-modules: Foo other-modules: Bar default-language: Haskell2010 ``` --- ## [hpack](https://github.com/sol/hpack): Removes redundancy #### You can list many things: - #### globally - #### on a per section basis (library / executable / test-suite) - #### global and per section lists are merged --- ## [hpack](https://github.com/sol/hpack): Removes redundancy ``` $ cat package.yaml --- ghc-options: -Wall dependencies: - base == 4.* - deepseq - directory - filepath - text source-dirs: src executables: foo: main: Main.hs source-dirs: driver tests: spec: main: Spec.hs source-dirs: test dependencies: - hspec == 2.* - mockery - QuickCheck ``` --- ## [hpack](https://github.com/sol/hpack): Sugarcoating for specifying a GitHub repository ``` github: sol/foo ``` ``` homepage: https://github.com/sol/foo#readme bug-reports: https://github.com/sol/foo/issues source-repository head type: git location: https://github.com/sol/foo ``` ## [hpack](https://github.com/sol/hpack): Gives you 100% control ``` homepage: null bug-reports: sol@typeful.net github: sol/foo ``` ``` bug-reports: sol@typeful.net source-repository head type: git location: https://github.com/sol/foo ``` --- ## [hpack](https://github.com/sol/hpack): Infers package name (use with care) ``` $ cat foo/package.yaml executables: foo: main: Main.hs ``` ``` $ (cd foo && hpack) ``` ``` $ cat foo/foo.cabal name: foo version: 0.0.0 build-type: Simple cabal-version: >= 1.10 executable foo main-is: Main.hs default-language: Haskell2010 ``` --- ## [hpack](https://github.com/sol/hpack): Things that are not covered by this talk - #### Infers `LICENSE` file - #### Supports most other Cabal fields, e.g. `category`, `synopsis` and `description` - #### Warns on unknown fields --- ## [hpack](https://github.com/sol/hpack): Project status - #### Documentation is lacking (the [README](https://github.com/sol/hpack#readme) contains links to more examples) - #### It's not [feature complete]() - #### New features are added as needed - #### I'm fine with using Cabal files for less frequest stuff
(at least for now) - #### It doesn't infer things from your local system - #### I use it every day - #### At [ZALORA](http://www.zalora.com/) we use it for all new projects --- layout: false class: middle, inverse ### #
</tinc>
## ### ### --- template: inverse # About [me](http://typeful.net) ## [sol](https://github.com/sol) on GitHub ## [solirc_](https://twitter.com/solirc_) on Twitter ## work at [ZALORA](http://www.zalora.com/) (we are hiring) ##