Existential Datatypes

Posted by igor Thu, 11 Sep 2008 01:38:00 GMT

A nice article by Oleg Kiselyov about Existential Datatypes. Enjoy!

foldl.com - foldr.com

Posted by igor Thu, 21 Aug 2008 21:44:00 GMT

If you are functional programmer you surely have used foldr or foldl before. By accident I found out that Oliver Steele registered the following domains:

:-)

George Orwell and Others Online

Posted by igor Mon, 11 Aug 2008 14:12:00 GMT

Under Australian copyright laws, copyright in literary works of authors, who died before 1955, has expired. These works are now within the ‘public domain’ in Australia and this is why the University of Adelaide is able to reproduce such works on the world wide web. Here go some of my favourites:

War in Georgia

Posted by igor Sun, 10 Aug 2008 14:41:00 GMT

“Long-escalating tensions between Russia and the former Soviet republic of Georgia erupted into full-scale war Friday, leaving hundreds if not thousands of civilians dead and turning thousands more into refugees, forced to flee for their lives.” [1]

It seems Georgia is another proxy state supported by the US to expand its imperialist plans. Everyone who knows a bit of history should not be surprised by what is going on. Mass media – as usual – doesn’t give the appropriate context in order to understand the conflict. But if you are looking for the truth, you can find it.

I would like to direct your attention to Bill Van Auken’s article US-Russian tensions in Caucasus erupt into war.

Here is a map of Georgia which might be useful in combination with the article, and further background reading:

Complexity of Type Reconstruction

Posted by igor Sun, 10 Aug 2008 13:17:00 GMT

Again I would like to draw an interesting example from Benjamin Pierce’s book Types and Programming Languages that is originally due to Kfoury, Tiuryn, and Urzyczyn. The following Haskell program is well typed but takes a very long time to typecheck:

module Main (main) where
main =
 let f0 = \x -> (x,x)
     f1 = \y -> f0 (f0 y)
     f2 = \y -> f1 (f1 y)
     f3 = \y -> f2 (f2 y)
     f4 = \y -> f3 (f3 y)
     f5 = \y -> f4 (f4 y)
 in
 f5 (\z -> z)
It has long been believed that type-checking programs in languages that allow for let-polymorphism appears to be “essentially linear” in the size of the input program. It therefore came as a surprise that its worst-case complexity is still exponential as the above example demonstrates ;-)

Playing with Rank-N Types

Posted by igor Sun, 10 Aug 2008 12:51:00 GMT

The following shows some dummy Haskell example code that demonstrates the usage of rank-n types:
{-# LANGUAGE RankNTypes #-}
module Main (main) where
-- g1: identity function
-- GHC implicitely quantifies it to: forall a. a -> a
g1 :: a -> a
g1 x = x
-- g2: Rank2Type
g2 :: (forall a. a -> a) -> (Bool, Char)
g2 f = (f True, f 'a')
-- g3: Rank3Type
g3 :: ((forall a. a -> a) -> (Bool, Char)) -> (Char, Bool)
g3 f = (\x -> (snd x, fst x)) (f g1)
-- g4: Rank4Type
g4 :: (((forall a. a -> a) -> (Bool, Char)) -> (Char, Bool)) ->
         (Bool, Char)
g4 f = (\x -> (snd x, fst x)) (f g2)

main :: IO ()
main = do
  putStrLn "Rank-2 Example:" 
  putStrLn . show . fst . g2 $ g1
  putStrLn . show . snd . g2 $ g1
  putStrLn "Rank-3 Example:" 
  putStrLn . show . fst . g3 $ g2
  putStrLn . show . snd . g3 $ g2
  putStrLn "Rank-4 Example:" 
  putStrLn . show . fst . g4 $ g3
  putStrLn . show . snd . g4 $ g3
If you want to see more ‘useful’ examples have a look at the paper Practical Type Inference for Arbitrary-Rank Types.

Predicative vs. Impredicative Polymorphism and Type Reconstruction

Posted by igor Sun, 10 Aug 2008 11:29:00 GMT

The polymorphism of System F is often called impredicative. A definition is called impredicative if it involves a quantifier whose domain includes the very thing being defined. For example in System F, the type variable X in the type T = ∀X. X → X ranges over all types, including T itself (so that, for example, we can instantiate a term of type T at type T, yielding a function from T to T).[6]

The polymorphism found in ML is called predicative, because the range of type variables is restricted to monotypes (i.e. quantifier-free types), which do not contain quantifiers.

When talking about type reconstruction the previous definitions are important. There is a growing “[...] need for ever more expressive type system features, most of which threaten the decidability and practicality of Damas-Milner type inference. One such feature is the ability to write functions with higher-rank types—that is, functions that take polymorphic functions as their arguments.”[1]

Complete type inference is known to be undecidable for higher-rank (impredicative) type systems. This post serves as a reference for type reconstruction in the presence of polymorphism in higher-rank type systems.

[1] Practical type inference for arbitrary-rank types

[2] Haskell/Polymorphism

[3] Type Polymorphism – DocForge

[4] Type Polymorphism -Wikipedia

[5] System F – Polymorphic/Second-Order Lambda Calculus

[6] Types and Programming Languages [p.360]

Mac OS X Leopard - GHC workaround for missing '_environ' symbol

Posted by igor Mon, 21 Jul 2008 16:01:00 GMT

If you managed to compile the latest darcs version of GHC (6.9.20080720 in my case) on Mac OS X Leopard, then there is a good chance that you ran into the following problem. I have opened a ticket with a solution proposal.

It’s not the cleanest solution but it works. Good luck!

Howard Zinn about Nationalism

Posted by igor Fri, 18 Jul 2008 10:47:00 GMT

I would like to point out the following article by Howard Zinn published a while ago on www.alternet.org. Although it has been a year since it was published the topic is still current and deserves attention.

American Dream

Posted by igor Sun, 06 Jul 2008 17:53:00 GMT

There is new movie coming out called the American Dream. It looks very interesting and features interviews with people like Howard Zinn and Danny Glover.

The movie webpage also features a very interesting trailer and teaser as well as a quite shocking ‘Facts’ page.

Older posts: 1 2 3 ... 14