syntax across languages

Jay Cox sqrtofone@yahoo.com
Sun, 10 Feb 2002 22:59:16 -0600 (CST)


On 11 Feb 2002, Pixel wrote:

> http://merd.net/pixel/language-study/syntax-across-languages.html
>
> CHANGES:
> - the page has now much more entries
> - one can check the missing entries per language at
>   http://merd.net/pixel/language-study/syntax-across-languages-per-language.html
>   (160KB)
>   see especially the haskell one
>   http://merd.net/pixel/language-study/syntax-across-languages-per-language.html#Haskell
>
>
> Contributions, suggestions and fixes are welcome.
>
>


Some random thoughts....

Under

     * Object Oriented & Reflexivity

       +---------------------------------------+
       | class             | class declaration |
       |-------------------+-------------------|
       | functional syntax | method invocation |
       +---------------------------------------+

I'm not sure anything under haskell can be considered OO but I'm no
languages expert.


You might could mention something about Type classes. This is the main
(only) method of overloading functions in haskell.

maybe you might make mention of polymorphic type system and how haskell
uses type inferencing to determine the meaning of expressions (relates to
type classes).


Using

data = Foo ...
really should be meantioned as a way to construct new types.
newtype = Foo ... (new type)

type Foo = ...
is only a type synonym. heres an example.
type String = [Char]




Under constrol structure, at least give mention to monads!
Common examples (ST,IO,List,Maybe) and "do notation"

Monads are defined by instanciating them under the Monad type class.
(basically giving definitions for the operators >>= (aka 'bind') and >>


I dont think you give list comprehensions a fair shake either.
(btw, list comprehension is an example of an alternative
syntax for using lists as a monad.)


[f z elem | anylistfromlistoflists <- listoflists,
            element<-anylistfromlistoflists,
            elem >= 3,
            z <- someotherlist]


References arent missing.  They are implemented under both the ST and IO
monads.


sprintf ... show ?? (still show peruses no format specifiers so it can be
kinda blah.)

(!!) extracts a char from String since type String = [Char]

oh, and it isnt missing those math functions either.  Take another look
at the Prelude (google search it as I'm to lazy to find out url for exact
page in haskell 98 report)


....


Oops, I see that "missing:" in your page really doesnt mean missing from
language.

A number of the "missing:" things (esp the math) can be had by just
looking at the Haskell Report. a google search "Haskell 98 Report Prelude"
probably gets you there.


You Have quite a list of languages there.  Seems like I've come upon your
page before.   I'm sure there'll be many more to bookmark it and use it.


Jay Cox