On Sunday 18 July 2010 22:19:21, Eitan Goldshtrom wrote: > Silly question, but I can't find the answer on the net. I think I'm just > using the wrong words in my search. I'm looking for a way to create > constant expressions in Haskell. The C/C++ equivalent of what I'm > talking about is > > #define NAME VALUE > > I want an expression, or really just numbers for what I'm doing, that > the compiler will put into the program at the designated places, instead > of storing it in memory like a variable. > > -Eitan
Just make a top-level definition name = value and if you want to make sure it's inlined, {-# INLINE name #-} Or you can use {-# LANGUAGE CPP #-} with the #define _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe