[Haskell-beginners] making function problem (chapter 6 of Programming in Haskell)

Roelof Wobben rwobben at hotmail.com
Mon Aug 8 13:06:03 CEST 2011




> To: beginners at haskell.org
> From: es at ertes.de
> Date: Mon, 8 Aug 2011 12:51:34 +0200
> Subject: Re: [Haskell-beginners] making function problem (chapter 6 of	Programming in Haskell)
> 
> Roelof Wobben <rwobben at hotmail.com> wrote:
> 
> > After a short holiday I now studying chapter 6 of this book.
> >
> > For the first exercise I have to make the function for ^ for postitive
> > numbers.
> 
> I assume you mean the exponentiation function, and the only real
> indication for that is the solution you quoted later in your post.  To
> help us help, you really should work on your problem descriptions.
> 
> 
> > Step 1 : Defining the type
> >
> > ^ :: [Int] -> Int
> 
> First of all, you have to learn proper Haskell syntax.  Your type
> signature is invalid.  But let me rewrite your type signature to correct
> syntax:
> 
>     (^) :: [Int] -> Int
> 
> This is the type signature for a function (^), which expects exactly one
> argument, a list.  Is this really what you want?  Before going any
> further, you should come up with the right type signature for your
> function.  Once you have that, we will continue.
> 

oke, 

I don't think I want that.
I want to type this  2^3 and then the outcome will be 8.
So next try 

(^) :: Int -> Int -> Int

Because the first and second numbers are integers and the outcome also will be a integer.

Roelof

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110808/61ebfe6a/attachment.htm>


More information about the Beginners mailing list