Paul Hudak paul.hudak at yale.edu
Thu Apr 21 11:03:58 EDT 2005

```Thomas Davie wrote:
> 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
> Bob

On the other hand, perhaps he wanted all possible combinations of values
in the lists a and b.  Since a list is a monad, this, for example, works
fine:

a = [1,2,3]
b = "there"
abs = do x <- a
y <- b
return (x,y)

In Hugs:
abs ==>
[(1,'t'),(1,'h'),(1,'e'),(1,'r'),(1,'e'),(2,'t'),(2,'h'),(2,'e'),(2,'r'),(2,'e')
,(3,'t'),(3,'h'),(3,'e'),(3,'r'),(3,'e')]

-Paul

```