logo       

RE: TH bug: Lift (a -> b) where: msg#00002

lang.haskell.glasgow.bugs

Subject: RE: TH bug: Lift (a -> b) where

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@xxxxxxxxxxx
[mailto:glasgow-haskell-bugs-
| bounces@xxxxxxxxxxx] On Behalf Of Saswat Anand
| Sent: 19 May 2004 21:05
| To: glasgow-haskell-bugs@xxxxxxxxxxx
| 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@xxxxxxxxxxx
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise