In GHC you can do this:
> import Data.Typeable
> isString :: (Typeable a) => a -> Bool
> isString x = typeOf x == typeOf (undefined::String)
Why do you want this? It's not the kind of operation one does very
often in Haskell.
Huong Nguyen wrote:
Hi all,
I want to write a small functionto test whether an input is a String or
not. For example,
isString::(Show a) =>a ->Bool
This function will return True if the input is a string and return False
if not
Any of you have idea about that? Thanks in advance
------------------------------------------------------------------------
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe