summaryrefslogtreecommitdiff
path: root/testsuite/tests/dcoercion/DCo_Specialise.hs
blob: fde5bfb54f7cadea55830a84218860bb55679e99 (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
{-# LANGUAGE Haskell2010 #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}

module DCo_Specialise ( rnStmts1 ) where

data RealWorld
newtype M a = M (RealWorld -> a)
fmapM :: (a -> b) -> M a -> M b
fmapM f (M k) = M (f . k)

data HsExpr
data SrcSpanAnnA

type family   Anno a
type instance Anno HsExpr = SrcSpanAnnA

type AnnoBody body0_ = ( Anno body0_ ~ SrcSpanAnnA )

rnStmts1 :: forall body1_ thing1_. AnnoBody body1_ => M (body1_, thing1_)
rnStmts1 = rnStmts2 @body1_ @thing1_

rnStmts2 :: forall body2_ thing2_. AnnoBody body2_ => M (body2_, thing2_)
rnStmts2 = rnStmts3 @(body2_, thing2_)

rnStmts3 :: M thing3_
rnStmts3 = fmapM snd $ rnStmts1 @HsExpr