Hacker News new | ask | show | jobs
by gigjbfjv 1772 days ago
Are you saying that you consider strings in Haskell to be a primitive?
1 comments

No, Haskell is weird since a string is [Char]. If it was it’s own value, yes.

The languages i’ve written are pretty basic. e.g. the data types might be

- Number - String - True, false, null - Array of values - Record of fields (key + value) - Variant of options (key + value)

So the distinction is clearer.

> No, Haskell is weird since a string is [Char].

I can think of various langages where string is not a built-in, but i can’t think of a langage where string is not some sort of sequence, not just in its implementation but in its interface.

The definition also breaks down quickly e.g. is a complex a primitive? If not because they have real and imaginary parts, why are floats which have a mantissa and an exponent? And what about functions? What even is a child? Are value-less sum types primitives but valued ones not?

More importantly, how does it matter? What does the distinction you draw provide that is useful?