import M(x)
import N(x)
y = M.x + N.x
>>= and the
unit return. There is also special syntax for
monad expressions using the new keyword do. E.g.
l = do
x <- [1 .. 4]
y <- [2 .. 3]
return (x*y)
l will be the list [2,3,4,6,6,9,8,12]
main =
do
putStr "Hello\n"
putStr "Give a file name\n"
name <- getLine
file <- readFile name
putStr "OK, here it is:\n"
putStr file
data Date = Date{ year::Int, month::Int, day::Int }
xmasDay = Date{ day<-25, year<-1995, month<-12 } -- record creation
nextYear = year xmasDay + 1 -- field extraction
nextXmas = xmasDay{ year<-nextYear } -- record "update"
There are still problems lurking (especially in the qualified name implementation), but it seems to work mostly. Please try it out if you feel like it.
WARNING! Do not mix code compiled with and without the 1.3 flag! Hbc gives you a few extras (like calling C), but I've not documented these yet.
If you have any problems just mail me.