I'm really new to Haskell programming. Can anyone help with this issues? -- delete the last character from a string in Haskell
deleteLast [] = "Empty list!" -- if the string is enpty
deleteLast (h:[]) = h -- recursion
deleteLast (h:t) = deleteLast t -- found the last character
result1 = [x | x == deleteLast , x /= deleteLast t] -- trying to remove the last character found
from the string
deleteLast "a"should be. This is the same ofdeleteLast ('a':[]), so you have to fix the linedeleteLast (h:[]) = h. That's not all you have to do, but it's a start."Empty list!!", the caller will not be able to distinguish the error from the correct result. Use theerrorfunction or theEithertype as return value.init? Is this homework?