User loginNavigation 
Working around limitations of wholeprogram monomorphizationI am interested in writing a compiler capable of doing wholeprogram monomorphization (similar to MLton) to allow for efficient data representations and other optimizations. However, I am also interested in supporting a number of features such as higher rank types, existential types (wrapped up via data constructors), userdefinable kinds, and polymorphic recursion. Since I'm only interested in being able to remove polymorphism over values, an obvious way of making this work would be to restrict things like polymorphic recursion to occurring over nonvaluekinded types. Images of types, combined with explicit wrapping and unwrapping, would allow things like the usual typed interpreter example (pretend Haskell has userdefinable kinds): {# LANGUAGE GADTs, EmptyDataDecls #}  kind Image_Kind data Int_Image  :: Image_Kind data Bool_Image  :: Image_Kind data Image a where Image_Int :: { int :: Int } > Image Int_Image Image_Bool :: { bool :: Bool } > Image Bool_Image data Exp a where Val :: Image Int_Image > Exp Int_Image Gt :: Exp Int_Image > Exp Int_Image > Exp Bool_Image If :: Exp Bool_Image > Exp a > Exp a > Exp a  eval :: forall (a :: Image_Kind). Exp a > Image a eval :: Exp a > Image a eval (Val n) = n eval (Gt a b) = Image_Bool (int (eval a) > int (eval b)) eval (If a b c) = if bool (eval a) then eval b else eval c x :: Int x = int $ eval (If (Gt (Val $ Image_Int 5) (Val $ Image_Int 3)) (Val $ Image_Int 42) (Val $ Image_Int 0)) Language support for getting "images" of types would make this less verbose. Is there any prior work in this area? How far can you push the limits? Are there any clever compilation schemes for tagging values with appropriate size/type data for selecting amongst monomorphic functions at runtime (which is essentially what you're doing manually with By John Nowak at 20100930 00:16  LtU Forum  previous forum topic  next forum topic  other blogs  5363 reads

Browse archivesActive forum topics 
Recent comments
3 days 4 hours ago
3 days 10 hours ago
3 days 12 hours ago
3 days 22 hours ago
5 days 17 hours ago
1 week 1 hour ago
1 week 1 hour ago
1 week 1 day ago
1 week 2 days ago
1 week 5 days ago