packages feed

smallcheck-kind-generics (empty) → 0.0.0.0

raw patch · 7 files changed

+176/−0 lines, 7 filesdep +basedep +gaugedep +kind-generics

Dependencies added: base, gauge, kind-generics, kind-generics-th, smallcheck, smallcheck-kind-generics

Files

+ CHANGELOG.md view
@@ -0,0 +1,11 @@+# Changelog++`smallcheck-kind-generics.hs` uses [PVP Versioning][1].+The changelog is available [on GitHub][2].++## 0.0.0.0++* Initially created.++[1]: https://pvp.haskell.org+[2]: https://github.com/strake/smallcheck-kind-generics.hs/releases
+ LICENSE view
@@ -0,0 +1,29 @@+BSD 3-Clause License++Copyright (c) 2020, M Farkas-Dyck+All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++1. Redistributions of source code must retain the above copyright notice, this+   list of conditions and the following disclaimer.++2. Redistributions in binary form must reproduce the above copyright notice,+   this list of conditions and the following disclaimer in the documentation+   and/or other materials provided with the distribution.++3. Neither the name of the copyright holder nor the names of its+   contributors may be used to endorse or promote products derived from+   this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ README.md view
@@ -0,0 +1,7 @@+# smallcheck-kind-generics.hs++[![Build status](https://img.shields.io/travis/strake/smallcheck-kind-generics.hs.svg?logo=travis)](https://travis-ci.org/strake/smallcheck-kind-generics.hs)+[![Hackage](https://img.shields.io/hackage/v/smallcheck-kind-generics.hs.svg?logo=haskell)](https://hackage.haskell.org/package/smallcheck-kind-generics.hs)+[![BSD-3-Clause license](https://img.shields.io/badge/license-BSD--3--Clause-blue.svg)](LICENSE)++See README for more info
+ bench/Main.hs view
@@ -0,0 +1,7 @@+module Main (main) where++import Gauge.Main+++main :: IO ()+main = defaultMain [bench "const" (whnf const ())]
+ smallcheck-kind-generics.cabal view
@@ -0,0 +1,81 @@+cabal-version:       2.4+name:                smallcheck-kind-generics+version:             0.0.0.0+synopsis:            See README for more info+description:         See README for more info+homepage:            https://github.com/strake/smallcheck-kind-generics.hs+bug-reports:         https://github.com/strake/smallcheck-kind-generics.hs/issues+license:             BSD-3-Clause+license-file:        LICENSE+author:              M Farkas-Dyck+maintainer:          strake888@gmail.com+copyright:           2020 M Farkas-Dyck+category:            Generics, Testing+build-type:          Simple+extra-doc-files:     README.md+                   , CHANGELOG.md+tested-with:         GHC == 8.6.5++common c+  build-depends:       base ^>= 4.12 || ^>= 4.13+  ghc-options:         +                     -Wall+                     -Wcompat+                     -Wredundant-constraints+                     -Wno-name-shadowing+                     -Wno-unticked-promoted-constructors+                     -Wincomplete-uni-patterns+                     -Wincomplete-record-updates+                     -Werror=incomplete-patterns+                     -Werror=incomplete-uni-patterns+                     -Werror=incomplete-record-updates+                     -Werror=missing-fields+                     -Werror=missing-methods+  default-language:    Haskell2010+  default-extensions:  UnicodeSyntax+                       LambdaCase+                       EmptyCase+                       InstanceSigs+                       PartialTypeSignatures+                       PolyKinds+                       ConstraintKinds+                       FlexibleContexts+                       FlexibleInstances+                       MonadComprehensions+                       StandaloneDeriving+                       DeriveFunctor+                       DeriveFoldable+                       DeriveTraversable++library+  import:              c+  hs-source-dirs:      src+  exposed-modules:     Test.SmallCheck.GenericK+  build-depends:       kind-generics ^>= 0.4+                     , kind-generics-th ^>= 0.2.1+                     , smallcheck ^>= 1.1.5++test-suite test+  import:              c+  type:                exitcode-stdio-1.0+  hs-source-dirs:      test+  main-is:             Spec.hs+  build-depends:       smallcheck-kind-generics+  ghc-options:         -threaded+                       -rtsopts+                       -with-rtsopts=-N++benchmark bench+  import:              c+  type:                exitcode-stdio-1.0+  hs-source-dirs:      bench+  main-is:             Main.hs+  build-depends:       gauge+                     , smallcheck-kind-generics+  ghc-options:         -threaded+                       -rtsopts+                       -with-rtsopts=-N++source-repository head+  type:                git+  location:            https://github.com/strake/smallcheck-kind-generics.hs.git
+ src/Test/SmallCheck/GenericK.hs view
@@ -0,0 +1,37 @@+{-# LANGUAGE TypeOperators #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE QuantifiedConstraints #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE GADTs #-}+{-# LANGUAGE UndecidableInstances #-}+module Test.SmallCheck.GenericK where++import Control.Applicative+import Data.Kind (Type)+import Generics.Kind++import Test.SmallCheck.Series++genericSeries :: ∀ m a x q . (GenericK a, GSerial m (RepK a) x) => q x -> Series m a+genericSeries _ = toK <$> (gSeries :: Series m (RepK a x))++class GSerial m (f :: LoT k -> Type) (x :: LoT k) where+    gSeries :: Series m (f x)++instance GSerial m U1 x where+    gSeries = pure U1+instance GSerial m V1 x where+    gSeries = empty+instance (Monad m, GSerial m f x, GSerial m g x) => GSerial m (f :+: g) x where+    gSeries = (L1 <$> gSeries) \/ (R1 <$> gSeries)+instance (Monad m, GSerial m f x, GSerial m g x) => GSerial m (f :*: g) x where+    gSeries = (:*:) <$> gSeries <~> gSeries+instance GSerial m f x => GSerial m (M1 i c f) x where+    gSeries = M1 <$> gSeries+instance (Serial m (Interpret t x)) => GSerial m (Field t) x where+    gSeries = Field <$> series+instance (∀ (t :: k) . GSerial m f (t :&&: x)) => GSerial m (Exists k f) x where+    gSeries = Exists <$> gSeries+instance (Interpret c x, GSerial m f x) => GSerial m (c :=>: f) x where+    gSeries = SuchThat <$> gSeries
+ test/Spec.hs view
@@ -0,0 +1,4 @@+module Main (main) where++main :: IO ()+main = putStrLn ("Test suite not yet implemented" :: String)