On 09/08/07, Andrew Coppin <[EMAIL PROTECTED]> wrote: > Which of these is likely to go faster? > > type Quad = (Bool,Bool) > > foo (r,t) = > let > x = if r ... > y = if t ... > in ... > > > > data Quad = BL | BR | TL | TR > > foo q = > let > x = if q == TL | q == TR ... > y = if q == BR | q == TR ... > in ... > > > > (Unless somebody has a better idea...) > > I'm hoping that the latter one will more more strict / use less space. > But I don't truely know... >
Sounds like the perfect candidate for a benchmark, then! Another tool for your toolbox: {-#OPTIONS -funbox-strict-fields #-} data Quad = Quad !Bool !Bool foo True True = ... foo True False = .... ... etc... The GHC option just causese GHC to unbox primitive types when they're strict in the data type, and the bangs cause them to be strict. -- Sebastian Sylvan +44(0)7857-300802 UIN: 44640862 _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe