2 simpleLazyPrint :: a -> IO ()
3 simpleLazyPrint x = print (primGetHugsObject x)
5 -- Extra level of indirection introduced to overcome lack of
6 -- polymorphic recursion!
7 print :: HugsObject -> IO ()
9 primClassifyObject False x >>= \ kind ->
21 putStr (primNameString nm)
24 putStr (primNameString nm)
27 putStr ('(' : replicate arity ',' ++ ")")
39 putStr ('\'' : showLitChar x "\'")
47 simpleStrictPrint :: a -> IO ()
48 simpleStrictPrint x = print (primGetHugsObject x)
50 -- Extra level of indirection introduced to overcome lack of
51 -- polymorphic recursion!
52 print :: HugsObject -> IO ()
54 primClassifyObject True x >>= \ kind ->
66 putStr (primNameString nm)
69 putStr (primNameString nm)
72 putStr ('(' : replicate arity ',' ++ ")")
84 putStr ('\'' : showLitChar x "\'")
90 -- could call lazy print (if object printer was exposed)
93 s1 = simpleStrictPrint (error "foo")
94 s2 = simpleStrictPrint (1 + error "foo")
99 lazyPrint x = hugsPrinter False (primGetHugsObject x)
100 strictPrint x = hugsPrinter True (primGetHugsObject x)
102 t1 = lazyPrint (True &&)
104 t3 = lazyPrint ('a':)
105 t4 = lazyPrint (1 `elem`)
106 t5 = lazyPrint "abcd"
107 t6 = strict lazyPrint (1 `elem`)
109 t11 = strictPrint (True &&)
110 t12 = strictPrint (1:)
111 t13 = strictPrint ('a':)
112 t14 = strictPrint (1 `elem`)
113 t15 = strictPrint "abcd"
114 t16 = strictPrint (take 10 [1..])
115 t17 = strictPrint [1..]
116 t18 = strictPrint (pi::Float) -- used to fail because pi is a CAF.
117 t19 = strictPrint '\DEL'
122 * Prints "(||) True False" (in lazy mode) instead of "True || False".
124 This is a deliberate change from the original Hugs version (in builtin.c)
125 which would print: '{dict} !! "abcd"' for ("abcd" !!) instead of
126 '(!!) {dict} "abcd"' or '("abcd" `(||) {dict}`)'.
128 (This is a feature not a bug!)
130 * Should print errors to stderr.