Send Beginners mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1.  Type assignment for List (RAJATKUMAR ZALA)
   2. Re:  Type assignment for List (yi lu)
   3. Re:  Type assignment for List (Rein Henrichs)
   4. Re:  Type assignment for List (Imants Cekusins)


----------------------------------------------------------------------

Message: 1
Date: Sun, 9 Aug 2015 12:21:16 +0800
From: RAJATKUMAR ZALA <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] Type assignment for List
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset=utf-8

Hello Friends,

I am totally new to Haskell. I am learning Haskell from a website on my own 
pace. From that site, I came to know about list in haskell and its type 
assignment. There is a confusable question on site. I am posting question 
here....



1. Given that the expression []:xs is well typed, which of the following is not 
a possible type assignment for xs?


Options:-

1. xs :: [Int]
2. xs :: [[Float]]
3. xs :: [[[Char]]]
4. xs :: [[[[Bool]]]] 


If any friend know about it then please clarify me on it.

Thanks in advance

Rajatkumar Zala
India


------------------------------

Message: 2
Date: Sun, 9 Aug 2015 13:11:47 +0800
From: yi lu <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Type assignment for List
Message-ID:
        <CAKcmqqxyNfpsFD0_eLUL7KRDKjQ-2AyXtOXo2rKbpGD+=t6...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

1

*Prelude> :t (:)*
*(:) :: a -> [a] -> [a]*

*xs will at least be a list of list.*

On Sun, Aug 9, 2015 at 12:21 PM, RAJATKUMAR ZALA <[email protected]>
wrote:

> Hello Friends,
>
> I am totally new to Haskell. I am learning Haskell from a website on my
> own pace. From that site, I came to know about list in haskell and its type
> assignment. There is a confusable question on site. I am posting question
> here....
>
>
>
> 1. Given that the expression []:xs is well typed, which of the following
> is not a possible type assignment for xs?
>
>
> Options:-
>
> 1. xs :: [Int]
> 2. xs :: [[Float]]
> 3. xs :: [[[Char]]]
> 4. xs :: [[[[Bool]]]]
>
>
> If any friend know about it then please clarify me on it.
>
> Thanks in advance
>
> Rajatkumar Zala
> India
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20150809/fce79af0/attachment-0001.html>

------------------------------

Message: 3
Date: Sun, 09 Aug 2015 06:24:11 +0000
From: Rein Henrichs <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Type assignment for List
Message-ID:
        <cajp6g8ypmotgscpoja97gg+e7vnb0m0jr3ta5fpa_8rp91k...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

What?

On Sat, Aug 8, 2015 at 10:11 PM yi lu <[email protected]> wrote:

> 1
>
> *Prelude> :t (:)*
> *(:) :: a -> [a] -> [a]*
>
> *xs will at least be a list of list.*
>
> On Sun, Aug 9, 2015 at 12:21 PM, RAJATKUMAR ZALA <[email protected]
> > wrote:
>
>> Hello Friends,
>>
>> I am totally new to Haskell. I am learning Haskell from a website on my
>> own pace. From that site, I came to know about list in haskell and its type
>> assignment. There is a confusable question on site. I am posting question
>> here....
>>
>>
>>
>> 1. Given that the expression []:xs is well typed, which of the following
>> is not a possible type assignment for xs?
>>
>>
>> Options:-
>>
>> 1. xs :: [Int]
>> 2. xs :: [[Float]]
>> 3. xs :: [[[Char]]]
>> 4. xs :: [[[[Bool]]]]
>>
>>
>> If any friend know about it then please clarify me on it.
>>
>> Thanks in advance
>>
>> Rajatkumar Zala
>> India
>> _______________________________________________
>> Beginners mailing list
>> [email protected]
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20150809/4be037ef/attachment-0001.html>

------------------------------

Message: 4
Date: Sun, 9 Aug 2015 08:53:53 +0200
From: Imants Cekusins <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Type assignment for List
Message-ID:
        <cap1qinzasg1nrghhy7cz+lyi059x_sc7bk5ktfvfwsgx-ue...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

Yi Lu is spot on right:

1. xs :: [Int]
Prelude> []:[1]
<interactive>:2:1:
    Non type-variable argument in the constraint: Num [t]
    (Use FlexibleContexts to permit this)
    When checking that ?it? has the inferred type
      it :: forall t. Num [t] => [[t]]

2. xs :: [[Float]]
Prelude> []:[[0.1]]
[[],[0.1]]

3. xs :: [[[Char]]]
Prelude> []:[[['a']]]
[[],["a"]]

4. xs :: [[[[Bool]]]]
Prelude> []:[[[[True]]]]
[[],[[[True]]]]


------------------------------

Subject: Digest Footer

_______________________________________________
Beginners mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners


------------------------------

End of Beginners Digest, Vol 86, Issue 6
****************************************

Reply via email to