[Haskell-cafe] getting last char of String

aditya siram aditya.siram at gmail.com
Fri Dec 31 21:43:16 CET 2010


-- untested and won't work on an infinite list
last :: [a] -> a
last = head . reverse

-deech

On Fri, Dec 31, 2010 at 2:39 PM, Aaron Gray <aaronngray.lists at gmail.com> wrote:
> Is there an easy Haskell function that gets the last Char of a [Char] or
> String ?
> Many thanks in advance,
> Aaron
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>



More information about the Haskell-Cafe mailing list