syntax across languages
11 Feb 2002 13:23:20 +0100
Jay Cox <firstname.lastname@example.org> writes:
> I'm not sure anything under haskell can be considered OO but I'm no
> languages expert.
IMO, it's very alike "mix-ins", Java's interfaces, pure abstract classes.
> 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).
syntax-across-languages doesn't favour big explainations :p
> 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]
ok (i won't mention that i always have a hard time dinstiguishing them)
> 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 >>
please be more precise, what do i put? in which category?
> 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,
> elem >= 3,
> z <- someotherlist]
i could add a category for list comprehension.
is this a good approximate syntax?
[ f x0 x1 ... | x0 <- a_list, pred x0, ... ]
> References arent missing. They are implemented under both the ST and IO
what is the syntax?
> sprintf ... show ?? (still show peruses no format specifiers so it can be
> kinda blah.)
no, "show" is really in the 'convert something to a string' category
> (!!) 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)