Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autoformat more directories #10491

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,23 @@ jobs:
- uses: haskell-actions/run-fourmolu@v11
with:
version: "0.12.0.0"
# NOTE: Keep this in sync with `../../Makefile`
pattern: |
bootstrap/**/*.hs
buildinfo-reference-generator/**/*.hs
Cabal/**/*.hs
Cabal-QuickCheck/**/*.hs
Cabal-described/**/*.hs
Cabal-hooks/**/*.hs
Cabal-syntax/**/*.hs
Cabal-tests/**/*.hs
Cabal-testsuite/main/**/*.hs
Cabal-testsuite/src/**/*.hs
Cabal-testsuite/static/**/*.hs
Cabal-tree-diff/**/*.hs
cabal-benchmarks/**/*.hs
cabal-dev-scripts/**/*.hs
cabal-install/**/*.hs
cabal-install-solver/**/*.hs
cabal-validate/**/*.hs
solver-benchmarks/**/*.hs
35 changes: 18 additions & 17 deletions Cabal-QuickCheck/src/Test/QuickCheck/GenericArbitrary.hs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeOperators #-}
module Test.QuickCheck.GenericArbitrary (
genericArbitrary,
GArbitrary,
) where

module Test.QuickCheck.GenericArbitrary
( genericArbitrary
, GArbitrary
) where

import GHC.Generics
import Test.QuickCheck
Expand All @@ -15,31 +16,31 @@ genericArbitrary :: (Generic a, GArbitrary (Rep a)) => Gen a
genericArbitrary = fmap to garbitrary

class GArbitrary f where
garbitrary :: Gen (f ())
garbitrary :: Gen (f ())

class GArbitrarySum f where
garbitrarySum :: [Gen (f ())]
garbitrarySum :: [Gen (f ())]

class GArbitraryProd f where
garbitraryProd :: Gen (f ())
garbitraryProd :: Gen (f ())

instance (GArbitrarySum f, i ~ D) => GArbitrary (M1 i c f) where
garbitrary = fmap M1 (oneof garbitrarySum)
garbitrary = fmap M1 (oneof garbitrarySum)

instance (GArbitraryProd f, i ~ C) => GArbitrarySum (M1 i c f) where
garbitrarySum = [fmap M1 garbitraryProd]
garbitrarySum = [fmap M1 garbitraryProd]

instance (GArbitrarySum f, GArbitrarySum g) => GArbitrarySum (f :+: g) where
garbitrarySum = map (fmap L1) garbitrarySum ++ map (fmap R1) garbitrarySum
garbitrarySum = map (fmap L1) garbitrarySum ++ map (fmap R1) garbitrarySum

instance (GArbitraryProd f, i ~ S) => GArbitraryProd (M1 i c f) where
garbitraryProd = fmap M1 garbitraryProd
garbitraryProd = fmap M1 garbitraryProd

instance GArbitraryProd U1 where
garbitraryProd = pure U1
garbitraryProd = pure U1

instance (GArbitraryProd f, GArbitraryProd g) => GArbitraryProd (f :*: g) where
garbitraryProd = (:*:) <$> garbitraryProd <*> garbitraryProd
garbitraryProd = (:*:) <$> garbitraryProd <*> garbitraryProd

instance (Arbitrary a) => GArbitraryProd (K1 i a) where
garbitraryProd = fmap K1 arbitrary
instance Arbitrary a => GArbitraryProd (K1 i a) where
garbitraryProd = fmap K1 arbitrary
Loading
Loading