Skip to content

Add more formatting rules #8999

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

Open
wants to merge 2 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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
10a14397e7295f79bb65ff505e52895f4864270a
c7a5ac671338998395c1d12f04a0f9190d89e3af
9985a2c27b1b292ca50489cf439193a8caa1249c
d1b1ef56393524a2d37abec78dbb0832e42c6698

# 2022
########################################
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,17 @@ jobs:
Cabal/**/*.hs
Cabal-syntax/**/*.hs
Cabal-install/**/*.hs
Cabal-QuickCheck/**/*.hs
Cabal-described/**/*.hs
Cabal-tests/**/*.hs
Cabal-tree-diff/**/*.hs
cabal-benchmarks/**/*.hs
cabal-dev-scripts/**/*.hs
cabal-install-solver/**/*.hs
solver-benchmarks/**/*.hs
!Cabal-syntax/src/Distribution/Fields/Lexer.hs
!Cabal-syntax/src/Distribution/SPDX/LicenseExceptionId.hs
!Cabal-syntax/src/Distribution/SPDX/LicenseId.hs
!Cabal/src/Distribution/Simple/Build/Macros/Z.hs
!Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs
!cabal-testsuite
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 @@ -19,31 +20,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