5 lookup1, lookup2, lookup3, tree1
9 import Spec ( Tree(..), lookup)
11 data UseTree a = UseTree (Tree Char# a)
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?
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
22 {- These should be ok -}
24 lookup1 = case (lookup eqInt# ltInt# 1# 1# (Leaf 1# 1#)) of i# -> I# i#
26 {- These should cause specialisation errors, unless added to Spec.hs -}
28 tree1 = UseTree (Leaf (case 'k' of C# k# -> k#) 1#)
30 lookup2 = case (lookup eqInt# ltInt# 1# 1.0# (Leaf 1# 1.0#)) of f# -> F# f#
32 lookup3 = case (lookup (==) (<) 1 1.0# (Leaf 1 1.0#)) of f# -> F# f#