[Template-haskell] RE: Aggressive inlining
Simon Peyton-Jones
simonpj at microsoft.com
Thu Nov 20 08:55:23 EST 2003
Sounds as if you might need Template Haskell
http://research.microsoft.com/~simonpj/papers/meta-haskell/
Simon
| -----Original Message-----
| From: haskell-cafe-bounces at haskell.org
[mailto:haskell-cafe-bounces at haskell.org] On Behalf Of Blue
| Steel
| Sent: 19 November 2003 22:43
| To: haskell-cafe at haskell.org
| Subject: Aggressive inlining
|
| 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.
|
| Consider
| ---------------------------------------------------
| 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
| http://antispam.yahoo.com/whatsnewfree
| _______________________________________________
| Haskell-Cafe mailing list
| Haskell-Cafe at haskell.org
| http://www.haskell.org/mailman/listinfo/haskell-cafe
More information about the template-haskell
mailing list