Saturday, September 27, 2008

xmonad talk @ FOSS Sea

Video and slides of my xmonad talk are now available (both are in Russian).

Sunday, September 7, 2008

Haskell puzzle: Either monad

Either is standard Haskell datatype defined by

data Either a b = Left a | Right b

Let's define Either monad as follows:

instance Monad (Either a) where
    return = Right
    x >>= f = case x of
        Left _ -> x
        Right r -> f r

This means we fix the type of Left part and consider Either a as monadic constructor of kind * -> *. Binding operator has the following sense: the function transforms data if it's Right and leaves it unchanged if it's Left (it's similar to Maybe monad, Right corresponding to Just and Left corresponding to Nothing).

Now the puzzle itself. 1) Why the above code won't typecheck and 2) how to make it valid with minimal changes?

The answer on the first question was obvious for me, and I thank #haskellers for giving me solution to the second.

Friday, September 5, 2008

Discrete mathematics seminar: announce

The opening of 30th cycle of seminars on discrete mathematics will be at 16.00 on September 8 (auditorium 73, Odessa State University main building).

Prof. Melnikov (Minsk) will give a lecture on teaching discrete mathematics in high school.

The chair of seminars — prof. Zykov (Odessa).

The cycle will last till September 12.