191ba32a5200ca927e73e4b77c64d4dc10f48b3f
[ghc-hetmet.git] / ghc / tests / specialise / code001 / Use.hs
1 module Use (
2
3         UseTree,
4
5         lookup1, lookup2, lookup3, tree1
6
7     ) where
8
9 import Spec     ( Tree(..), lookup)
10
11 data UseTree a = UseTree (Tree Char# a)
12
13         -- specialised version of UseTree Int# will be created
14         -- however, since the a is not a direct component this is
15         -- identical to the original version!
16         -- ToDo: avoid creating such versions?
17
18         -- this data declaration does not in itself require specialisations of Tree
19         -- these will only be required by code which constructs the values placed
20         -- inside a use of this data declaration
21
22 {- These should be ok -}
23
24 lookup1 = case (lookup eqInt# ltInt# 1# 1# (Leaf 1# 1#)) of i# -> I# i#
25
26 {- These should cause specialisation errors, unless added to Spec.hs -}
27
28 tree1   = UseTree (Leaf (case 'k' of C# k# -> k#) 1#)
29
30 lookup2 = case (lookup eqInt# ltInt# 1# 1.0# (Leaf 1# 1.0#)) of f# -> F# f#
31
32 lookup3 = case (lookup (==) (<) 1 1.0# (Leaf 1 1.0#)) of f# -> F# f#
33