summaryrefslogtreecommitdiff
path: root/testsuite/tests/generics/T5462Yes2.hs
blob: 9c222554aa9e49d0c2a678953b79bf810ded2856 (plain)
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
{-# LANGUAGE FlexibleContexts              #-}
{-# LANGUAGE FlexibleInstances             #-}
{-# LANGUAGE DeriveGeneric                 #-}
{-# LANGUAGE DefaultSignatures             #-}
{-# LANGUAGE StandaloneDeriving            #-}
{-# LANGUAGE UndecidableInstances          #-}
{-# LANGUAGE DeriveAnyClass                #-}
{-# LANGUAGE GeneralizedNewtypeDeriving    #-}

module Main where

import GHC.Generics hiding (C, C1, D)
import GFunctor

class C1 a where
  c1 :: a -> Int
  c1 _ = 1

class C2 a where
  c21 :: a -> Int
  c21 = c22
  c22 :: a -> Int
  c22 = c21
  {-# MINIMAL c21 | c22 #-}

newtype D = D Int deriving C1

instance C1 Int where c1 _ = 2

newtype F a = F1 [a]
  deriving (Show, Eq, Generic, Generic1, GFunctor)

data G = G1 deriving (C1)
data H = H1 deriving (C2)


main = print (c1 (D 3))