Skip to content

Commit

Permalink
Rebased for transfer of repo to byteverse.
Browse files Browse the repository at this point in the history
Removed GH workflows.
Fixed tests.
Bumped primitive dependency version.
Added Eq and Show to data types.
Code cleanup.
Bumped version number to 0.3.2.0 and updated changelog.
Add missing test suite data to extra-source-files
brianjosephmckeon authored Jan 25, 2024
1 parent 134d6ba commit 90c115a
Showing 13 changed files with 407 additions and 315 deletions.
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
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Revision history for http-interchange

## 0.3.?.? -- 2024-??-??

* List test suite file dependencies in `extra-source-files` so that Hackage
is able to run the test suite.

## 0.3.2.0 -- 2024-01-16

* Add `Eq` and `Show` to all data types.

## 0.3.1.0 -- 2023-08-16

* Add these to `Http.Headers`: cons, snoc, lookupHost, lookupAccept,
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
@@ -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
@@ -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" }
]
}
84 changes: 49 additions & 35 deletions http-interchange.cabal
Original file line number Diff line number Diff line change
@@ -1,54 +1,68 @@
cabal-version: 3.0
name: http-interchange
version: 0.3.1.0
license: BSD-3-Clause
license-file: LICENSE
author: Andrew Martin
maintainer: andrew.thaddeus@gmail.com
synopsis: Types and serialization for HTTP
cabal-version: 3.0
name: http-interchange
version: 0.3.2.1
license: BSD-3-Clause
license-file: LICENSE
author: Andrew Martin
maintainer: andrew.thaddeus@gmail.com
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
extra-doc-files: CHANGELOG.md

copyright: 2023 Andrew Martin
category: Data
build-type: Simple
extra-doc-files:
CHANGELOG.md
README.md
extra-source-files:
golden/request/*.json
golden/request/*.txt
golden/request/*.input
golden/request/*.output
golden/response/*.json
golden/response/*.txt
golden/response/*.input
golden/response/*.output

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 (Eq, Show)
Loading

0 comments on commit 90c115a

Please sign in to comment.