File: GH6Spec.hs

package info (click to toggle)
haskell-deriving-compat 0.6.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 492 kB
  • sloc: haskell: 6,121; makefile: 5
file content (44 lines) | stat: -rw-r--r-- 926 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{-# LANGUAGE TemplateHaskell #-}

{-|
Module:      GH6Spec
Copyright:   (C) 2015-2017 Ryan Scott
License:     BSD-style (see the file LICENSE)
Maintainer:  Ryan Scott
Portability: Template Haskell

A regression test for
https://github.com/haskell-compat/deriving-compat/issues/6.
-}
module GH6Spec (main, spec) where

import Data.Deriving (deriveEq1, deriveOrd1)
import Data.Proxy (Proxy(..))

import OrdSpec (ordSpec)

import Prelude ()
import Prelude.Compat

import Test.Hspec (Spec, describe, hspec, parallel)
import Test.QuickCheck (Arbitrary(..), oneof)

data Foo a
 = Foo1  a
 | Foo2  a
 | Foo3  a
 | Foo4  a
 | Foo5  a
 deriving (Eq, Ord, Show)

deriveEq1  ''Foo
deriveOrd1 ''Foo

instance Arbitrary a => Arbitrary (Foo a) where
  arbitrary = oneof $ map (<$> arbitrary) [Foo1, Foo2, Foo3, Foo4, Foo5]

main :: IO ()
main = hspec spec

spec :: Spec
spec = parallel $ describe "GH6" $ ordSpec (Proxy :: Proxy (Foo Int))