Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
* Reformatted.
* Added GH workflows.
* Fixed tests.
* Bumped primitive dependency version.
  • Loading branch information
brianjosephmckeon authored Jan 16, 2024
1 parent 134d6ba commit 2826eb7
Show file tree
Hide file tree
Showing 16 changed files with 450 additions and 308 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/build-arm64-main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: main arm64

on:
push:
branches:
- main

workflow_dispatch:
branches:
- main

jobs:
call-workflow:
uses: layer-3-communications/.github/.github/workflows/build-haskell.yaml@main
with:
build-arch: arm64
slack-name: ${{ github.ref_name }}
secrets: inherit
14 changes: 14 additions & 0 deletions .github/workflows/build-arm64-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: pull request arm64

on:
pull_request:
branches:
- "*"

jobs:
call-workflow:
uses: layer-3-communications/.github/.github/workflows/build-haskell.yaml@main
with:
build-arch: arm64
slack-name: ${{ github.event.pull_request.head.ref }}
secrets: inherit
18 changes: 18 additions & 0 deletions .github/workflows/build-x64-main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: main x64

on:
push:
branches:
- main

workflow_dispatch:
branches:
- main

jobs:
call-workflow:
uses: layer-3-communications/.github/.github/workflows/build-haskell.yaml@main
with:
build-arch: x64
slack-name: ${{ github.ref_name }}
secrets: inherit
14 changes: 14 additions & 0 deletions .github/workflows/build-x64-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: pull request x64

on:
pull_request:
branches:
- "*"

jobs:
call-workflow:
uses: layer-3-communications/.github/.github/workflows/build-haskell.yaml@main
with:
build-arch: x64
slack-name: ${{ github.event.pull_request.head.ref }}
secrets: inherit
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.vscode/
dist
dist-*
cabal-dev
Expand Down
51 changes: 51 additions & 0 deletions fourmolu.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Number of spaces per indentation step
indentation: 2

# Max line length for automatic line breaking
column-limit: 200

# Styling of arrows in type signatures (choices: trailing, leading, or leading-args)
function-arrows: trailing

# How to place commas in multi-line lists, records, etc. (choices: leading or trailing)
comma-style: leading

# Styling of import/export lists (choices: leading, trailing, or diff-friendly)
import-export-style: leading

# Whether to full-indent or half-indent 'where' bindings past the preceding body
indent-wheres: false

# Whether to leave a space before an opening record brace
record-brace-space: true

# Number of spaces between top-level declarations
newlines-between-decls: 1

# How to print Haddock comments (choices: single-line, multi-line, or multi-line-compact)
haddock-style: multi-line

# How to print module docstring
haddock-style-module: null

# Styling of let blocks (choices: auto, inline, newline, or mixed)
let-style: auto

# How to align the 'in' keyword with respect to the 'let' keyword (choices: left-align, right-align, or no-space)
in-style: right-align

# Whether to put parentheses around a single constraint (choices: auto, always, or never)
single-constraint-parens: always

# Output Unicode syntax (choices: detect, always, or never)
unicode: never

# Give the programmer more choice on where to insert blank lines
respectful: true

# Fixity information for operators
fixities: []

# Module reexports Fourmolu should know about
reexports: []

14 changes: 6 additions & 8 deletions golden/response/001.output
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ Response
{ statusLine =
StatusLine { statusCode = 200 , statusReason = "OK" }
, headers =
fromListN
3
[ Header
{ name = "Date" , value = "Tue, 18 Apr 2023 16:05:21 GMT" }
, Header
{ name = "Content-Type" , value = "text/html; charset=utf-8" }
, Header { name = "Transfer-Encoding" , value = "chunked" }
]
[ Header
{ name = "Date" , value = "Tue, 18 Apr 2023 16:05:21 GMT" }
, Header
{ name = "Content-Type" , value = "text/html; charset=utf-8" }
, Header { name = "Transfer-Encoding" , value = "chunked" }
]
}
8 changes: 3 additions & 5 deletions golden/response/002.output
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ Response
{ statusLine =
StatusLine { statusCode = 400 , statusReason = "Bad Request" }
, headers =
fromListN
2
[ Header { name = "Content-Type" , value = "application/json" }
, Header { name = "Content-Length" , value = "100" }
]
[ Header { name = "Content-Type" , value = "application/json" }
, Header { name = "Content-Length" , value = "100" }
]
}
71 changes: 37 additions & 34 deletions http-interchange.cabal
Original file line number Diff line number Diff line change
@@ -1,54 +1,57 @@
cabal-version: 3.0
name: http-interchange
version: 0.3.1.0
license: BSD-3-Clause
license-file: LICENSE
author: Andrew Martin
maintainer: [email protected]
synopsis: Types and serialization for HTTP
cabal-version: 3.0
name: http-interchange
version: 0.3.1.0
license: BSD-3-Clause
license-file: LICENSE
author: Andrew Martin
maintainer: [email protected]
synopsis: Types and serialization for HTTP
description:
Types and serialization for HTTP. This includes things like request
line, status line, and headers. There is also a collection type
for headers that supports fast, case-insensitive lookup.
copyright: 2023 Andrew Martin
category: Data
build-type: Simple

copyright: 2023 Andrew Martin
category: Data
build-type: Simple
extra-doc-files: CHANGELOG.md

library
ghc-options: -Wall -O2
ghc-options: -Wall -O2
exposed-modules:
Http.Request
Http.Response
Http.Bodied
Http.Header
Http.Headers
Http.Request
Http.Response
Http.Types

build-depends:
, base >=4.16.3.0 && <5
, bytesmith >=0.3.10
, byteslice >=0.2.11
, primitive >=0.7.4
, text >=2.0
, bytebuild >=0.3.10
, contiguous >=0.6.3
hs-source-dirs: src
, base >=4.16.3.0 && <5
, bytebuild >=0.3.10
, byteslice >=0.2.11
, bytesmith >=0.3.10
, contiguous >=0.6.3
, primitive >=0.9.0
, text >=2.0

hs-source-dirs: src
default-language: GHC2021

test-suite test
ghc-options: -Wall
ghc-options: -Wall
default-language: GHC2021
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: Main.hs
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: Main.hs
build-depends:
, aeson >=2.1
, base >=4.16.3.0
, http-interchange
, tasty >=1.4.3
, tasty-golden >=2.3.5
, aeson >=2.1
, base >=4.16.3.0
, byteslice
, bytestring >=0.11
, filepath
, bytestring >=0.11
, primitive >=0.7.4
, pretty-show >=1.10
, http-interchange
, pretty-show >=1.10
, primitive >=0.9.0
, tasty >=1.4.3
, tasty-golden >=2.3.5
9 changes: 5 additions & 4 deletions src/Http/Bodied.hs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
module Http.Bodied
( Bodied(..)
( Bodied (..)
) where

import Data.Bytes.Chunks (Chunks)

-- | An HTTP request or response with a body.
data Bodied a = Bodied
{ metadata :: !a
-- ^ The request or response.
-- ^ The request or response.
, body :: !Chunks
-- ^ The body.
} deriving (Show,Eq)
-- ^ The body.
}
deriving (Show, Eq)
Loading

0 comments on commit 2826eb7

Please sign in to comment.