> isString::(Show a) =>a ->Bool
> This function will return True if the input is a string and return False if
> not
This is not particularly nicely - you certainly can't write it as
simple as the 'isString' function, and it will probably require type
classes etc, quite possibly with haskell extensions. Since haskell is
a statically typed langauge the idea is that you know if something is
a string before you run the program, not only at runtime.

Why is it you want this? Perhaps what you are hoping to accomplish
could be done some other way, without requiring this isString
function.

Of course, if you want a slightly hacky version:

isString x = not (null a) && head a == '\"' && last a == '\"'
   where a = show x

is probably good enough :)

Thanks

Neil
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to