Re: [stack] still catching up

Louis Madon — 2000-09-14 07:00:04

phimvt@... wrote:

> 3. Thanks to Louis for a long discussion on Haskell. My own
> knowledge of Haskell (0.01 %) is only marginally better than
> my knowledge of Swahili (0.00 %).
> I was familiar with the
> "Any" type, and that one can have lists of "Any". Am I right
> that in list literals every item then has to be preceded by
> "Any", thus:
> [ Any 123, Any "abc", Any 'X' ]

Yes.

> That would make it impractical to use the Haskell reader for
> reading Joy mixed lists or even programs.

You could use a shorter name for the existential constructor, eg:

[ A 123, A "abc", A 'x' ]

sz used a slightly different approach in his "Joy in Haskell"
interpreter; the variable typing was represented by a sum type and a set
of associated functions, jl for list, jc for character, jb for boolean
etc. So the above would look like,

[ ji 123, js "abc", jc 'x' ]

In general, I don't think you can avoid prefixing everything within a
mixed list if the Haskell reader is to be used.

> It is not quite
> as bad in Prolog, where the only annoyance are the commas
> separating the items.

Ok, I imagine prolog is dynamically typed (?), so it would be easier
there.

> So a Haskell implementation of something
> Joy-like will need a proper scanner and parser?

I believe so, at least I can't think of a way around it. (Ofcourse a Joy
scanner/parser isn't exactly hard to do ...)


--
Louis.