Skip to content

Commit

Permalink
Merge pull request #60 from anton-k/build-ghc-9.2.4
Browse files Browse the repository at this point in the history
Build on ghc-9.2.5
  • Loading branch information
anton-k authored Nov 5, 2023
2 parents ca5e578 + ac29823 commit 24ffe8d
Show file tree
Hide file tree
Showing 23 changed files with 66 additions and 57 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,25 @@ The name `mig` (pronounced as meeg) is a russian word for "instant moment".
* Quick start guide: [tutorial](https://anton-k.github.io/mig/)
* Summary of the main functions: [refs](https://anton-k.github.io/mig/09-reference.html)
* How to contribute: [guide](https://anton-k.github.io/mig/10-how-to-contribute.html)

### Structure of the repo

An overview of the mig repo:

* `mig` - core library. It defines DSL and low-level represenatation for API and server as a function

* `mig-wai` - conversion of mig servers to WAI applications

* `mig-extra` - extra utils for core library

* `mig-swagger-ui` - swagger servers for mig servers. Offers nice in the browser UI to test HTTP REST applications

* `mig-server` - mig servers based on warp with batteries included

* `mig-rio` - binding to rio library. It comtains instance of the `HasServer` class for RIO type.

* `examples` - several examples of servers and clients. Examples can be run with commands in the [`Makefile`](https://github.com/anton-k/mig/blob/main/examples/mig-example-apps/Makefile) of their subdirectory.

* `docs` - tutorial for the library and reference of the main functions. It is build with `mdbook` and deployed on github pages.

See [`Makefile`](https://github.com/anton-k/mig/blob/main/Makefile) for main commands to work with repo in dev mode.
4 changes: 2 additions & 2 deletions docs/src/01-hello-world.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Let's be more specific and study our example.
The type of the handler is `Get IO (Resp Text)`
In our case we get:

```
```haskell
(/.) :: Path -> Get IO (Resp Text) -> Server IO
```

Expand All @@ -72,7 +72,7 @@ The type-level function `MonadOf` knows how to extract `IO` from `Get IO (Resp T

Let's study the signature of the `hello` handler:

```
```haskell
hello :: Get IO (Resp Json Text)
| | | | |
| | | | +-- response body converted to byte string
Expand Down
2 changes: 1 addition & 1 deletion docs/src/02-request-anatomy.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Also there are similar modules for:

Servers for HTML take one step further and remove `Resp` from the equation:

```
```haskell
type Get a = Send GET IO (Resp Html a)
type Post a = Send POST IO (Resp Html a)
```
Expand Down
2 changes: 1 addition & 1 deletion docs/src/04-other-monads.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ and trying things out with swagger.

Note that we use bind operator:

```
```haskell
runServer port =<< renderServer server env
```

Expand Down
4 changes: 2 additions & 2 deletions docs/src/07-blog-post-example.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# HTML example: Blog site

We have seen many examples of JSON applications. But we can send data in other formats too.
Most common forma t for human-readable information for HTTP applications
Most common format for human-readable information for HTTP applications
is HTML. Any site that we visit sends HTML pages to us. Let's create a simple
site that shows blog posts and quotes and we can add new blog posts to it.
Complete code for example is in the [`mig` repo](https://github.com/anton-k/mig/tree/main/examples/mig-example-apps/Html)
Expand Down Expand Up @@ -44,7 +44,7 @@ So we report errors to user in HTML-pages.

Let's define a function that will start an empty server:

```
```haskell
module Main (
main,
) where
Expand Down
18 changes: 2 additions & 16 deletions docs/src/10-how-to-contribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Also there is a CI which checks for:
* build and test of all libraries with stack
* build and test of all examples in the directory `examples` with stack
* `fourmolu` formatting
* deploy of docs/tutorial to github pages (on push to main branch)

## how to automate formatter check

Expand All @@ -28,18 +29,6 @@ else
echo "fourmolu cannot be found"
echo "install fourmolu via cabal install"
fi

if command -v cabal-fmt &> /dev/null
then
files=$(git diff --staged --diff-filter=ACMR --name-only -- '*.cabal')
for file in $files
do
cabal-fmt --inplace --no-tabular $file
git add $file
done
else
echo "cabal-fmt cannot be found"
fi
```

Save this as file `.git/hooks/pre-commit` in your repo
Expand All @@ -49,10 +38,7 @@ and make it executable:
chmod +x .git/hooks/pre-commit
```

The script requires two executables which both can be installed from Hackage:

* `fourmolu`
* `cabal-fmt`
The script requires `fourmolu` executable which both can be installed from Hackage.

After that all files that you modify will be formatted properly.
Formatting settings are in the file `fourmolu.yaml`.
4 changes: 2 additions & 2 deletions mig-client/mig-client.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cabal-version: 1.12
-- see: https://github.com/sol/hpack

name: mig-client
version: 0.1.0.0
version: 0.1.0.1
synopsis: Build http-clients from API definition for mig servers
description: With this library we can build client functions for HTTP-applications
from the same code as server definition.
Expand Down Expand Up @@ -50,7 +50,7 @@ library
, http-client
, http-media
, http-types
, mig >=0.2
, mig >=0.2.0.1
, mtl
, text
default-language: GHC2021
4 changes: 2 additions & 2 deletions mig-client/package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: mig-client
version: 0.1.0.0
version: 0.1.0.1
github: "anton-k/mig"
license: BSD3
author: "Anton Kholomiov"
Expand Down Expand Up @@ -28,7 +28,7 @@ dependencies:
- bytestring
- containers
- http-api-data
- mig >= 0.2
- mig >= 0.2.0.1
- http-client
- http-media
- mtl
Expand Down
4 changes: 2 additions & 2 deletions mig-extra/mig-extra.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cabal-version: 1.12
-- see: https://github.com/sol/hpack

name: mig-extra
version: 0.1.0.0
version: 0.1.0.1
synopsis: Extra utils for Mig core library
description: Extra utils for mig server library
category: Web
Expand Down Expand Up @@ -62,7 +62,7 @@ library
, http-api-data
, http-media
, http-types
, mig >=0.2
, mig >=0.2.0.1
, mig-client
, openapi3
, template-haskell
Expand Down
4 changes: 2 additions & 2 deletions mig-extra/package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: mig-extra
version: 0.1.0.0
version: 0.1.0.1
github: "anton-k/mig"
license: BSD3
author: "Anton Kholomiov"
Expand Down Expand Up @@ -33,7 +33,7 @@ default-extensions:
dependencies:
- base >= 4.7 && < 5
- data-default
- mig >= 0.2
- mig >= 0.2.0.1
- http-api-data
- blaze-html
- http-types
Expand Down
4 changes: 2 additions & 2 deletions mig-rio/mig-rio.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cabal-version: 1.12
-- see: https://github.com/sol/hpack

name: mig-rio
version: 0.1.0.0
version: 0.1.0.1
synopsis: Utils to use RIO with mig library
description: Utils to use mig with rio library
category: Web
Expand Down Expand Up @@ -35,6 +35,6 @@ library
ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -Wunused-packages
build-depends:
base >=4.7 && <5
, mig-server
, mig-server >=0.1.0.1
, rio
default-language: GHC2021
4 changes: 2 additions & 2 deletions mig-rio/package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: mig-rio
version: 0.1.0.0
version: 0.1.0.1
github: "anton-k/mig"
license: BSD3
author: "Anton Kholomiov"
Expand All @@ -25,7 +25,7 @@ default-extensions:

dependencies:
- base >= 4.7 && < 5
- mig-server
- mig-server >= 0.1.0.1
- rio

ghc-options:
Expand Down
8 changes: 4 additions & 4 deletions mig-server/mig-server.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cabal-version: 1.12
-- see: https://github.com/sol/hpack

name: mig-server
version: 0.1.0.0
version: 0.1.0.1
synopsis: Build lightweight and composable servers
description: With library mig we can build lightweight and composable servers.
There are only couple of combinators to assemble servers from parts.
Expand Down Expand Up @@ -103,10 +103,10 @@ library
, data-default
, http-api-data
, http-types
, mig >=0.2
, mig-extra >=0.1
, mig >=0.2.0.1
, mig-extra >=0.1.0.1
, mig-swagger-ui >=0.1
, mig-wai >=0.1
, mig-wai >=0.1.0.1
, openapi3
, text
, transformers
Expand Down
8 changes: 4 additions & 4 deletions mig-server/package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: mig-server
version: 0.1.0.0
version: 0.1.0.1
github: "anton-k/mig"
license: BSD3
author: "Anton Kholomiov"
Expand Down Expand Up @@ -84,9 +84,9 @@ default-extensions:
dependencies:
- aeson
- base >= 4.7 && < 5
- mig >= 0.2
- mig-extra >= 0.1
- mig-wai >= 0.1
- mig >= 0.2.0.1
- mig-extra >= 0.1.0.1
- mig-wai >= 0.1.0.1
- http-types
- text
- http-api-data
Expand Down
4 changes: 2 additions & 2 deletions mig-swagger-ui/mig-swagger-ui.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cabal-version: 1.12
-- see: https://github.com/sol/hpack

name: mig-swagger-ui
version: 0.1.0.0
version: 0.1.0.1
synopsis: Swagger servers for mig library
description: Appends swagger servers for mig servers.
Example of the usage. This code adds swagger server which is serverd on path "swagger-ui" to our server
Expand Down Expand Up @@ -69,7 +69,7 @@ library
, file-embed-lzma
, http-api-data
, lens
, mig >=0.2
, mig >=0.2.0.1
, openapi3
, text
default-language: GHC2021
4 changes: 2 additions & 2 deletions mig-swagger-ui/package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: mig-swagger-ui
version: 0.1.0.0
version: 0.1.0.1
github: "anton-k/mig"
license: BSD3
author: "Anton Kholomiov"
Expand Down Expand Up @@ -35,7 +35,7 @@ dependencies:
- bytestring
- text
- lens
- mig >= 0.2
- mig >= 0.2.0.1
- file-embed-lzma
- blaze-html
- blaze-markup
Expand Down
4 changes: 2 additions & 2 deletions mig-wai/mig-wai.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cabal-version: 1.12
-- see: https://github.com/sol/hpack

name: mig-wai
version: 0.1.0.0
version: 0.1.0.1
synopsis: Render mig-servers as wai-applications
description: Library to render mig-servers as WAI-applications.
category: Web
Expand Down Expand Up @@ -43,7 +43,7 @@ library
, containers
, data-default
, exceptions
, mig >=0.2
, mig >=0.2.0.1
, text
, wai
default-language: GHC2021
4 changes: 2 additions & 2 deletions mig-wai/package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: mig-wai
version: 0.1.0.0
version: 0.1.0.1
github: "anton-k/mig"
license: BSD3
author: "Anton Kholomiov"
Expand Down Expand Up @@ -31,7 +31,7 @@ dependencies:
- base >= 4.7 && < 5
- bytestring
- containers
- mig >= 0.2
- mig >= 0.2.0.1
- text
- wai
- exceptions
Expand Down
4 changes: 3 additions & 1 deletion mig/mig.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cabal-version: 1.12
-- see: https://github.com/sol/hpack

name: mig
version: 0.2.0.0
version: 0.2.0.1
synopsis: Build lightweight and composable servers
description: The Core for the mig server library.
With library mig we can build lightweight and composable servers.
Expand Down Expand Up @@ -68,6 +68,7 @@ library
DerivingStrategies
StrictData
AllowAmbiguousTypes
DataKinds
ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -Wunused-packages
build-depends:
aeson
Expand Down Expand Up @@ -114,6 +115,7 @@ test-suite mig-test
DerivingStrategies
StrictData
AllowAmbiguousTypes
DataKinds
ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -Wunused-packages -threaded -rtsopts -with-rtsopts=-N
build-depends:
aeson
Expand Down
3 changes: 2 additions & 1 deletion mig/package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: mig
version: 0.2.0.0
version: 0.2.0.1
github: "anton-k/mig"
license: BSD3
author: "Anton Kholomiov"
Expand Down Expand Up @@ -40,6 +40,7 @@ default-extensions:
- DerivingStrategies
- StrictData
- AllowAmbiguousTypes
- DataKinds

language: GHC2021

Expand Down
2 changes: 0 additions & 2 deletions mig/test/Test/Server/Counter.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{-# LANGUAGE DataKinds #-}

-- | Test case for ReaderT based server
module Test.Server.Counter (spec) where

Expand Down
1 change: 0 additions & 1 deletion mig/test/Test/Server/RouteArgs.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveAnyClass #-}

-- | Tests for various inputs for requests
Expand Down
5 changes: 3 additions & 2 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
resolver:
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/21/5.yaml
resolver: nightly-2023-11-04 # ghc-9.6.3
# lts-21.19 # ghc-9.4.7
# lts-20.0 # ghc-9.2.5

packages:
- mig
Expand Down

0 comments on commit 24ffe8d

Please sign in to comment.