[Haskell-beginners] Are these soloutions all valid and a good use of Haskell
Leza Morais Lutonda
leza.ml at fecrd.cujae.edu.cu
Mon Nov 10 18:52:21 UTC 2014
Hi Roelof,
On 10/11/14 10:10, Roelof Wobben wrote:
> No problem .
>
> Im strugelling to make acc work.
>
> I try to say that if the input list has only 1 item the outcome is the
> head of that list.
> But doing
>
> acc = Just (head a) or doing acc = Just (head acc) gives both that
> acc or a is not in scope
The `a` in the type signature `acc :: a -> Maybe a -> Maybe a` is not a
variable name, it is a type.
>
> also doing acc x = Just (head x) gives a error messages that the types
> are not matching.
:t Just (head x)
Maybe a
:t acc x
Maybe a -> Maybe a
So, the compiler is right!
>
> Roelof
>
>
>
--
Leza Morais Lutonda, Lemol-C
Electronic and Telecommunication Engineer
Software Development and Architecture Enthusiast
http://lemol.github.io
50 Aniversario de la Cujae. Inaugurada por Fidel el 2 de diciembre de 1964 http://cujae.edu.cu
More information about the Beginners
mailing list