
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

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
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 Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners

What?
On Sat, Aug 8, 2015 at 10:11 PM yi lu
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
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 Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners

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]]]]
participants (4)
-
Imants Cekusins
-
RAJATKUMAR ZALA
-
Rein Henrichs
-
yi lu