get first char from string haskell

To get the first character from a string in Haskell, you can use the head function. The head function returns the first element of a list, so you can treat the string as a list of characters and use head to get the first character. Here's an example:

getFirstChar :: String -> Char
getFirstChar str = head str

In this example, the getFirstChar function takes a String as input and returns a Char. It simply calls the head function on the input string to get the first character. You can use this function to get the first character from any string in Haskell.