[Haskell-cafe] a newbie's question

Thomas Davie tom.davie at gmail.com
Thu Apr 21 10:53:48 EDT 2005

On Apr 21, 2005, at 3:47 PM, SCOTT J. wrote:

> Hi,
> I'm beginning to study Haskell, For the following
> a = [1,2,3]
> b = "there"
> do x <- a
>       y <- b
>      return (x , y)
> Winhugs cannot run it. Gives
>  Syntax error in input (unexpected backslash (
> lambda))
Your problem is that you're using monads to grab the contents of a  
and b, while a and b are not monadic... You probably if you're only  
just setting out don't want to pay attention to any of the do  
notation or monadic code.  To get the result it looks like you want,  
all you need to do is this:
(a, b)
you can then define this as a new constant:
c = (a, b)

Hope that helps


More information about the Haskell-Cafe mailing list