I'm new to Haskell and coding in general and am having a bit of a problem.
sti :: [Char] -> [Integer]
sti "" = [fromIntegral (ord x)| x<-""]
So what I am trying to do with the above is create a list of integers from a string, for example "Hello" becomes ['H','e','l','l','o'] and then I turn that list into their respective ord values from Data.Char.
My problem is that when I try to use this function I get: Non-exhaustive patterns in function sti. Does this mean there are instances where I can't take the ord x of a string? And if so how would I go about fixing that?
Anything help would be appreciated.
""is an empty string, you need a variable instead. This question lacks minimal understanding of the problem. I suggest, you first visit www.learnyouahaskell.com - Nikita Volkovsti = fmap (fromIntegral . ord)- Rein Henrichs