blob: 6eb9870fcd7bd86562f6c23b4b498eaa60f34cef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
{-# LANGUAGE DataKinds, ExistentialQuantification, MagicHash, RankNTypes,
TypeApplications #-}
import GHC.Records (HasField(..))
data T = MkT { foo :: forall a . a -> a }
data U = forall b . MkU { bar :: b }
-- This should fail because foo is higher-rank.
x = getField @"foo" (MkT id)
-- This should fail because bar is a naughty record selector (it
-- involves an existential).
y = getField @"bar" (MkU True)
main = return ()
|