TH bug: Lift (a -> b) where
Simon Peyton-Jones
simonpj at microsoft.com
Wed Jun 2 04:21:00 EDT 2004
This isn't a bug, in fact. TH certainly lets you write programs that,
when GHC runs them for you, will loop, and this is one of them.
When you write
instance Lift (a -> b) where
lift f = [| f |]
that is shorthand for
instance Lift (a->b) where
lift f = lift f
and that gives the infinite loop.
Simon
| -----Original Message-----
| From: glasgow-haskell-bugs-bounces at haskell.org
[mailto:glasgow-haskell-bugs-
| bounces at haskell.org] On Behalf Of Saswat Anand
| Sent: 19 May 2004 21:05
| To: glasgow-haskell-bugs at haskell.org
| Subject: TH bug: Lift (a -> b) where
|
| Hello,
|
| I dont know if it has been reported, this looks like a bug in TH. The
| program goes into infinite loop.
|
| Saswat
|
| -----------------------------
| instance Lift (a -> b) where
| lift f = [| f |]
|
| compile :: (a -> b) -> ExpQ
| compile p = lift p
|
| printE :: ExpQ -> IO ()
| printE expQ = do exp <- unQ expQ
| putStrLn (show exp)
|
| inc x = x + 1
|
| main = printE (compile inc)
| -----------------------------
|
|
| _______________________________________________
| Glasgow-haskell-bugs mailing list
| Glasgow-haskell-bugs at haskell.org
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
More information about the Glasgow-haskell-bugs
mailing list