[Haskell-cafe] Can I use String without "" in ghci?

Richard A. O'Keefe ok at cs.otago.ac.nz
Mon Sep 2 02:13:49 CEST 2013


On 1/09/2013, at 6:02 PM, yi lu wrote:

> I want to know if it is possible that I use strings without "".
> 
> If I type
> Prelude>foo bar
> which actually I mean
> Prelude>foo "bar"
> However I don't want to type ""s.
> 
> I have noticed if bar is predefined or it is a number, it can be used as arguments. But can other strings be used this way?

If bar is predefined, it *isn't* the string 'b':'a':'r':[].
If bar is a number, it *isn't* a string.
So "other strings" is quite misleading.

In Haskell, if you use strings a lot, you are probably doing
something wrong.  For things that are not text manipulation
tasks, there is practically always a better type, and these
days, for things that _are_ text manipulation, there is
practically always a better type.

A slogan I have programmed by since I first met C and recognised
how vastly superior to PL/I it was for text manipulation _because_
it didn't have a proper string type is "Strings are Wrong!".






More information about the Haskell-Cafe mailing list