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

Henk-Jan van Tuyl hjgtuyl at chello.nl
Sun Nov 9 20:52:17 UTC 2014


You must add something like
   module X where
at the top of your file, to indicate that this is not the main module  
(where you must specify a main function).

Groeten,
Henk-Jan van Tuyl


On Sun, 09 Nov 2014 14:11:12 +0100, 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.


-- 
Folding at home
What if you could share your unused computer power to help find a cure? In  
just 5 minutes you can join the world's biggest networked computer and get  
us closer sooner. Watch the video.
http://folding.stanford.edu/


http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
Haskell programming
--


More information about the Beginners mailing list