summaryrefslogtreecommitdiff
path: root/testsuite/tests/printer/T13199.hs
blob: 0bc36f3730e4634d3fffe6ac8045121a5ff4ac25 (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
38
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE ViewPatterns #-}
{-# OPTIONS_GHC -ddump-splices -dsuppress-uniques #-}
module Bug where

class C a b c
data B a b = B { aa :: a, bb :: b }

-- Types requiring parens.
$([d| instance C (Maybe a) (Maybe b) c
    |])

-- ---------------------------------------------------------------------
-- Patterns requiring parens according to hsPatNeedsParens

-- SigPatIn. What about SigPatOut?
$([d| g (a :: (Int -> Int) -> Int) = True |])

-- ViewPat
$([d| h (id -> x) = True |])

-- PrefixCon with non-null args
$([d| f (Just (Just False)) = True |])

-- InfixCon for ConPatIn
$([d| i (B (a `B` c) d) = True |])

-- RecCon does not
$([d| j B { aa = a} = True |])


$([d| k = id @(Maybe Int) |])

$([d| l = case Just 'a' of Just a -> Just ((\x -> x) a) |])