summaryrefslogtreecommitdiff
path: root/testsuite/tests/th/T12478_3.hs
blob: 7c84eee50fd73e7e23de64c8f8d43be6bf744ac7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE UnboxedSums #-}
module T12478_3 where

import Language.Haskell.TH

$(do let ubxSum = unboxedSumT 2 `appT` conT ''Int `appT` conT ''Int
     x <- newName "x"
     y <- newName "y"

     [d| swap :: $(ubxSum) -> $(ubxSum)
         swap $(unboxedSumP (varP x) 1 2) = $(unboxedSumE (varE x) 2 2)
         swap $(unboxedSumP (varP y) 2 2) = $(unboxedSumE (varE y) 1 2)
      |])