Re: [Haskell-cafe] How do you make constant expressions?

2010-07-19 Thread Eitan Goldshtrom
Awesome. It worked. Haskell continues to impress me. Thanks for the help everyone. -Eitan On 7/19/2010 4:42 AM, Max Bolingbroke wrote: Use NoMonomorphismRestriction or give an explicit type signature: width :: Num a => a width = 800 Max ___ H

Re: [Haskell-cafe] How do you make constant expressions?

2010-07-19 Thread Max Bolingbroke
Use NoMonomorphismRestriction or give an explicit type signature: width :: Num a => a width = 800 Max On 19 July 2010 09:17, Eitan Goldshtrom wrote: > Correction to my last e-mail. I figured out why it worked at first and then > failed, so I'll refine my question. I'd like the compiler to simpl

Re: [Haskell-cafe] How do you make constant expressions?

2010-07-19 Thread Ivan Lazar Miljenovic
Eitan Goldshtrom writes: > Correction to my last e-mail. I figured out why it worked at first and > then failed, so I'll refine my question. I'd like the compiler to > simply put the number 800 everywhere that I put the name "width" in my > code. Instead it's putting (800 :: Float), or Double or

Re: [Haskell-cafe] How do you make constant expressions?

2010-07-19 Thread Eitan Goldshtrom
Correction to my last e-mail. I figured out why it worked at first and then failed, so I'll refine my question. I'd like the compiler to simply put the number 800 everywhere that I put the name "width" in my code. Instead it's putting (800 :: Float), or Double or Int, whatever I want, but it's

Re: [Haskell-cafe] How do you make constant expressions?

2010-07-19 Thread Eitan Goldshtrom
One point of clarification that'd be nice. I'm getting some type errors that I wasn't getting before, so I'd just like to know something about the inline pragma. I have width = 800 {-# INLINE width #-} main = (truncate width, fromIntegral width) Now when I ran this program it seemed to work a

Re: [Haskell-cafe] How do you make constant expressions?

2010-07-18 Thread Daniel Fischer
On Sunday 18 July 2010 23:07:38, Eitan Goldshtrom wrote: > So just so I get this straight, the following are equivalent to the > computer, after compiling: > > 1. > fact = 10 > {-# INLINE fact #-} > > func x = x * fact > > 2. > func x = x * 10 I'm not sure if they're equivalent when compiled witho

Re: [Haskell-cafe] How do you make constant expressions?

2010-07-18 Thread Eitan Goldshtrom
So just so I get this straight, the following are equivalent to the computer, after compiling: 1. fact = 10 {-# INLINE fact #-} func x = x * fact 2. func x = x * 10 I'm also curious as to what the {-# #-} brackets represent. I've never seen those before. -Eitan

Re: [Haskell-cafe] How do you make constant expressions?

2010-07-18 Thread Jesper Louis Andersen
On Sun, Jul 18, 2010 at 10:19 PM, 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 > > #defin

Re: [Haskell-cafe] How do you make constant expressions?

2010-07-18 Thread Felipe Lessa
On Sun, Jul 18, 2010 at 5:19 PM, 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

Re: [Haskell-cafe] How do you make constant expressions?

2010-07-18 Thread Daniel Fischer
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 > > #defin

[Haskell-cafe] How do you make constant expressions?

2010-07-18 Thread Eitan Goldshtrom
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 w