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

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@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

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
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@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@haskell.org http://www.haskell.org/mailman/listinfo/beginners

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
Thanks,
I changed it to this :
last2::[a]-> a last2::last[a]
but now I see these error messages:
src/Main.hs@1:1-1:6 The type signature forlast2 lacks an accompanying binding src/Main.hs@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@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
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@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@haskell.org http://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing listBeginners@haskell.orghttp://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

Have you read this
http://ics.p.lodz.pl/~stolarek/_media/pl:research:stolarek_understanding_bas...?
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
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
wrote: Thanks,
I changed it to this :
last2::[a]-> a last2::last[a]
but now I see these error messages:
src/Main.hs@1:1-1:6 The type signature forlast2 lacks an accompanying binding src/Main.hs@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@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
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@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@haskell.org http://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing listBeginners@haskell.orghttp://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing listBeginners@haskell.orghttp://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

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
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
wrote: Thanks,
I changed it to this :
last2::[a]-> a last2::last[a]
but now I see these error messages:
src/Main.hs@1:1-1:6 The type signature forlast2 lacks an accompanying binding
src/Main.hs@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@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
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@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@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 --
participants (5)
-
akash g
-
Henk-Jan van Tuyl
-
Jeffrey Brown
-
May Khaw
-
Roelof Wobben