String != [Char]

Gabriel Dos Reis gdr at integrable-solutions.net
Sun Mar 25 23:51:49 CEST 2012


On Sun, Mar 25, 2012 at 4:03 PM, Daniel Peebles <pumpkingod at gmail.com> wrote:
> On Sun, Mar 25, 2012 at 3:47 PM, Gabriel Dos Reis
> <gdr at integrable-solutions.net> wrote:
>>
>>
>> We are doing our students no favor, no good, in being condescending to
>> them pretending that they can't handle teaching material that would
>> actually
>> be close real world experience.  If we truly believe that they don't have
>> enough time to learn what would really be useful to them, then we are
>> truly wasting their valuable time teaching them things they would have to
>> unlearn before writing good and correct code.  The education would have
>> been a complete failure and waste of resources.
>>
>
> When people teach Haskell, it typically isn't to give them "real world
> experience", but to teach them an interesting programming language and all
> the great computer science it leads to.

Yes, but you have to frame it in the context of interesting problems, otherwise
it reduces to a series of dry, pointless, uninspiring series functions
named f, g, h :-)


> Types, laziness, higher-order
> abstractions are the hard bits to learn, not a string-processing API.
>
> If people want to learn how to deal with unicode correctly, I can think of
> several better places to learn about it than a Haskell course.

I don't think anybody suggested that a Haskell course should be a substitute
for Unicode course.  However, I maintain that it isn't an excuse to purposefully
teach something that the students have to unlearn.

> I don't think
> it's condescending or impractical to focus on the things that make Haskell
> unique, rather than teaching a unicode-correct API that could conceivably be
> written in any other language.

Why should a Unicode-correct API would have to be written in any other
language and not Haskell?

> Learning that real human text cannot be
> treated just an independent list of characters is something that takes
> minutes to hours at most: someone tells you that there are all sorts of
> exceptions to the list-of-chars paradigm, and then you read an article or
> two on the language-specific difficulties, learn to use specialized API
> functions, and then you get on with what you were actually trying to do.

Which brings us back to square zero: Is there any fundamental reason
why the language can't provide a good Unicode-correct API  to illustrate
solutions to text processing problems (many of them interesting) and that
can be used in introductory classes instead of having to say the
above.  Students,
like most children, learn by imitation.  They will replicate whatever they
are shown (for a long period of time, if not forever.) If it is true
that students
don't time, why should they have to waste that scarce resource listening to the
list-of-char  paradigm in the first place?

> So I think saying that ignoring unicode-correct strings a complete failure
> and waste of resources is a bit hyperbolic, honestly.

It may be an inconvenient truth, but not hyperbole [ I see you are
trying to be polite :-) ]  Look at the almost permanent damage done by the
culture that equated 'char*' to strings.  It may be inconvenient to say, but
[Char] isn't any better -- in fact, I'll go further and say: it is
spreading the same
damage but only with a different syntax.  The damage is semantics, no amount
of syntax clothing will undo it.  I realize that may appear as a
strong statement,
but think about it.

-- Gaby



More information about the Haskell-prime mailing list