Re: Deriviable type classes
Hi, 2011/2/10 Yitzchak Gale g...@sefer.org Simon Peyton-Jones wrote: Generic Defaults... will replace... the Derivable type classes stuff... in GHC 7.2 or 7.4... Please yell if you are a secret user of derivable type classes, so this change would discombobulate you. Could you give us a preview of the parts of the syntax spectrum that will be gobbled up by this? That is a way that the change could affect even people who are not using the current generics. As far as I understand, only the keyword generic will be taken. A new GHC.Generics module will define many new types with common names like `C` and `D`; these are used for the generic representation of datatypes in any module that enables -XGenerics, but there are no clashes unless the programmer explicitly imports GHC.Generics, so that should be ok. For example, the old generics knocked a very nice bracket out of consideration for TH syntax. It also blessed the names of certain magical constructors, which can be good to know about even if the magic doesn't leak out of the generics world. I remember there was some strange behavior with a type constructor `1` which was supposedly caused by the old generics (or was it syb?). Hopefully there will be nothing like that in the new mechanism. Cheers, Pedro Thanks, Yitz ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
StgExpr AST
Hello, Is there a way to get access to the STG syntax tree of a program using the GHC api? i.e. a function that returns something of type `StgExpr' that can be used in a way similar to this: example module = defaultErrorHandler defaultDynFlags $ do runGhc (Just libdir) $ do dflags - getSessionDynFlags setSessionDynFlags dflags target - guessTarget targetFile Nothing setTargets [target] load LoadAllTargets modSum - getModSummary $ mkModuleName module p - parseModule modSum t - typecheckModule p d - desugarModule t c - return $ coreModule d s - coreToStg c return s Thanks for any help, Chris ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: StgExpr AST
On Thu, Feb 10, 2011 at 1:09 PM, Chris Nicholls chrisnichol...@gmail.com wrote: Hello, Is there a way to get access to the STG syntax tree of a program using the GHC api? i.e. a function that returns something of type `StgExpr' that can be used in a way similar to this: example module = defaultErrorHandler defaultDynFlags $ do runGhc (Just libdir) $ do dflags - getSessionDynFlags setSessionDynFlags dflags target - guessTarget targetFile Nothing setTargets [target] load LoadAllTargets modSum - getModSummary $ mkModuleName module p - parseModule modSum t - typecheckModule p d - desugarModule t c - return $ coreModule d s - coreToStg c return s I've written Haskell to Javascript translator using GHC API. And I've ended with the following code to access STG: https://github.com/sviperll/ghcjs/blob/master/src/Compiler/Main.hs -- Victor Nazarov ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users