summaryrefslogtreecommitdiff
path: root/testsuite/tests/quotes/TH_tf2.hs
blob: 9f313d4a3ea1d81af418bceecf48d3bea868fe97 (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
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE AllowAmbiguousTypes #-}  -- 'bar' is ambiguous

module TH_tf2 where

{-
$( [d| class C a where
         data T a
         foo :: Bool -> T a |] )

$( [d| instance C Int where
         data T Int = TInt Bool
         foo b = TInt (b && b) |] )

$( [d| instance C Float where
         data T Float = TFloat {flag :: Bool}
         foo b = TFloat {flag = b && b} |] )
-}

class D a where
         type S a
         bar :: S a -> Int

instance D Int where
         type S Int = Bool
         bar c = if c then 1 else 2