Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#4324 closed bug (invalid)

Template Haskell: Splicing Infinite Syntax Tree doesn't stop

Reported by: guest Owned by:
Priority: normal Milestone:
Component: Template Haskell Version: 6.12.3
Keywords: template haskell splice loop Cc: konn.jinro@…, shelarcy@…
Operating System: MacOS X Architecture: x86
Type of failure: Compile-time performance bug Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

Splicing an infinite syntax tree causes compile-time infinite loop.

e.g.

{-# LANGUAGE TemplateHaskell #-}
import Data.Function
$(fix id)

doesn't stop.

Change History (3)

comment:1 Changed 9 years ago by igloo

Resolution: invalid
Status: newclosed

That's the expected behaviour. The splice is a program that is run at compile-time, so if it doesn't terminate then neither will compilation.

comment:2 in reply to:  1 Changed 9 years ago by shelarcy

Cc: shelarcy@… added

Replying to igloo:

That's the expected behaviour. The splice is a program that is run at compile-time, so if it doesn't terminate then neither will compilation.

Really?

GHC can check infinite loop with no action when we use compiled program.

import Data.Function
main = fix id
$ ghc --make Test.hs
[1 of 1] Compiling Main             ( Test.hs, Test.o )
Linking Test.exe ...

$ ./Test.exe
Test.exe: <<loop>>

But GHCi and Template Haskell does not.

Prelude Data.Function> fix id

So, Template Haskell doesn't report this error at compile time.

I think that it is the problem what guest want to fix.

comment:3 Changed 9 years ago by simonmar

Thanks for the clarification; we already have a ticket for this: #2786

Note: See TracTickets for help on using tickets.