Aggressive inlining

Blue Steel bluesteel0001 at
Wed Nov 19 14:43:29 EST 2003

I'm working on a parlor trick.

I would like to solve a 3-SAT problem at compile time,
so that the executable is super fast.

formula (x1,x2,x3) = (x1 || x2) && x3

tf = [True, False]

assignments = [(x1,x2,x3)|x1<-tf,x2<-tf,x3<-tf]

solutions = filter formula assignments

main = do print solutions

Theoretically, a compiler could optimize this to
main = do print [(True,True,True),...]

Is this actually possible in GHC?  I've played with
inline pragmas and looked at -ddump-..., but I haven't
made much progress.

Of course, the goal is to replace "formula" with a
formula that takes a 30-tuple instead of a triple and
really let GHC crank.

Thanks for any help.

Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard

More information about the Haskell-Cafe mailing list