[Haskell-cafe] Question about data

2011-08-19 Thread Paul Reiners
I've created a simple type declaration: data MathExpression = Float | Add MathExpression MathExpression | Subtract MathExpression MathExpression | Multiply MathExpression MathExpression | Divide MathExpression MathExpression deriving (Show) Now how do I create an instance of

[Haskell-cafe] Compilation error in Chapter 5 of "Real World Haskell"

2011-08-17 Thread Paul Reiners
I'm trying to do the following from Chapter 5 of "Real World Haskell": Our choice of naming for the source file and function is deliberate. To create an executable, *ghc* expects a module named Main that contains a function named main. The main function is the one that will be called when we run t

Re: [Haskell-cafe] Couldn't match expected type `Integer' against inferred type `Int'

2011-08-08 Thread Paul Reiners
On Aug 8, 2011, at 7:59 PM, Ivan Lazar Miljenovic wrote: > On 9 August 2011 10:49, Paul Reiners wrote: >> Why am I getting this error: >> >> Couldn't match expected type `Integer' against inferred type `Int' >> In the expression: f

[Haskell-cafe] Couldn't match expected type `Integer' against inferred type `Int'

2011-08-08 Thread Paul Reiners
Why am I getting this error: > Couldn't match expected type `Integer' against inferred type `Int' > In the expression: foldl step 0 xs > In the definition of `asInt_foldAux': > asInt_foldAux xs > = foldl step 0 xs > where >

[Haskell-cafe] Binding of an integer variable

2011-07-28 Thread Paul Reiners
I have a question about the following GHCi interaction: Prelude> let x = 23 Prelude> :show bindings x :: Integer = _ What is the meaning of the underscore in the third line? Why doesn't it say this, instead? x :: Integer = 23 ___ Haskell-Cafe mailing

[Haskell-cafe] Input redirection in WinGHCi

2011-07-27 Thread Paul Reiners
I know I can do the following from a command prompt: $ runghc WC < quux.txt How do I do this in WinGHCi? I know I have to first load the file like this: Prelude> :load WC But then what? This doesn't work: *Main> WC < quux.txt :1:1: Not in scope: data constructor `WC' :1:6: Not in scope: `quu