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
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
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
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
>
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
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