[Haskell-beginners] type of zipWithPlus
Russ Abbott
russ.abbott at gmail.com
Thu Sep 30 23:43:19 EDT 2010
Thanks. I tried the first two, which worked.
Previously I had tried:
> let (zipWithPlus :: Num a => [a] -> [a] -> [a]) = zipWith (+)
<interactive>:1:5:
Illegal signature in pattern: (Num a) => [a] -> [a] -> [a]
Use -XScopedTypeVariables to permit it
I tried setting -XScopedTypeVariables. When I ran it again I got a different
error message:
Prelude> let (zipWithPlus :: Num a => [a] -> [a] -> [a]) = zipWith (+)
<interactive>:1:5:
Illegal polymorphic or qualified type:
forall a. (Num a) => [a] -> [a] -> [a]
Perhaps you intended to use -XRankNTypes or -XRank2Types
In a pattern type signature: (Num a) => [a] -> [a] -> [a]
In the pattern: zipWithPlus :: (Num a) => [a] -> [a] -> [a]
In a pattern binding:
(zipWithPlus :: (Num a) => [a] -> [a] -> [a]) = zipWith (+)
-- Russ Abbott
______________________________________
Professor, Computer Science
California State University, Los Angeles
Google voice: 424-242-USA0 (last character is zero)
blog: http://russabbott.blogspot.com/
vita: http://sites.google.com/site/russabbott/
______________________________________
On Thu, Sep 30, 2010 at 12:48 PM, Daniel Fischer
<daniel.is.fischer at web.de>wrote:
> let zipWithPlus xs ys = zipWith (+) xs ys
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20100930/4d0cba39/attachment-0001.html
More information about the Beginners
mailing list