[Haskell-beginners] invalid type signature last2::: [a] -> a

Jeffrey Brown jeffbrown.the at gmail.com
Sun Nov 9 19:05:39 UTC 2014


Have you read this
<http://ics.p.lodz.pl/~stolarek/_media/pl:research:stolarek_understanding_basic_haskell_error_messages.pdf>?
I found it fascinating, helpful, and (perhaps unlike most papers out there
on Haskell) not at all difficult to read quickly.

On Sun, Nov 9, 2014 at 5:11 AM, Roelof Wobben <r.wobben at home.nl> wrote:

>  Thanks,
>
> Now when I run it, I see a error message that main is missing.
> and I cannot find in theIlearnyouahaskell how to solve this.
>
> Roelof
>
>
>
>
> May Khaw schreef op 9-11-2014 11:17:
>
> The first one means that you gave a type signature for a function you did
> not define.
>
> The second one means that there are 2 last2 type signature, but you can
> only have one.
>
> What you want is something like :
> last2 :: [a] - > a
> last2 list = (put your function here)
>
> On Sun, 9 Nov 2014 21:02 Roelof Wobben <r.wobben at home.nl> wrote:
>
>>  Thanks,
>>
>> I changed it to this :
>>
>> last2::[a]-> a
>> last2::last[a]
>>
>> but now I see these error messages:
>>
>>  src/Main.hs at 1:1-1:6 The type signature forlast2 lacks an accompanying
>> binding
>>  src/Main.hs at 2:1-2:6 Duplicate type signatures for last2
>> at
>> /home/app/isolation-runner-work/projects/75679/session.207/src/src/Main.hs:1:1-5
>>
>>
>> /home/app/isolation-runner-work/projects/75679/session.207/src/src/Main.hs:2:1-5
>> src/Main.hs at 2:1-2:6
>>  The type signature for last2 lacks an accompanying binding
>>
>>
>>
>> akash g schreef op 9-11-2014 10:48:
>>
>> The naming convention for variables and functions is that they should
>> start with a lower case letter.  Types have capitalized names.
>>
>>
>> On Sun, Nov 9, 2014 at 3:12 PM, Roelof Wobben <r.wobben at home.nl> wrote:
>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> Hello,
>>>
>>> I try to solve the 99 haskell problems on several ways.
>>>
>>> But my first try which looks like this :
>>>
>>> Last2::[a]-> a
>>> Last2:: last[list]
>>>
>>> gives the following error message :
>>>
>>> src/Main.hs at 1:1-1:6
>>> Invalid type signature: Last2 :: [a] -> a Should be of form <variable>
>>> :: <type>
>>>
>>> What am trying to do is say the input is a list which can be of integers
>>> or chars so everything is the output can then also be of type everything.
>>>
>>> Roelof
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Beginners mailing list
>>> Beginners at haskell.org
>>> http://www.haskell.org/mailman/listinfo/beginners
>>>
>>>
>>
>>
>> _______________________________________________
>> Beginners mailing listBeginners at haskell.orghttp://www.haskell.org/mailman/listinfo/beginners
>>
>>
>>  _______________________________________________
>> Beginners mailing list
>> Beginners at haskell.org
>> http://www.haskell.org/mailman/listinfo/beginners
>>
>
>
> _______________________________________________
> Beginners mailing listBeginners at haskell.orghttp://www.haskell.org/mailman/listinfo/beginners
>
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20141109/b5917284/attachment-0001.html>


More information about the Beginners mailing list