X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Futils%2Fgenprimopcode%2FMain.hs;h=d92d3a97c59a86da59c77d1276eb6571a50a07d8;hb=74775c6b3cb5c511af4312868ee26bdea18a0fd7;hp=f9306fbad07f1010ae31e83eff0405991531c434;hpb=c11b62bf763e6495eee53c73721db40ebd3a6a8d;p=ghc-hetmet.git diff --git a/ghc/utils/genprimopcode/Main.hs b/ghc/utils/genprimopcode/Main.hs index f9306fb..d92d3a9 100644 --- a/ghc/utils/genprimopcode/Main.hs +++ b/ghc/utils/genprimopcode/Main.hs @@ -1,11 +1,16 @@ - +{-# OPTIONS -cpp #-} ------------------------------------------------------------------ -- A primop-table mangling program -- ------------------------------------------------------------------ module Main where +#if __GLASGOW_HASKELL__ >= 504 +import Text.ParserCombinators.Parsec +#else import Parsec +#endif + import Monad import Char import List @@ -378,7 +383,7 @@ ppType (TyApp "RealWorld" []) = "realWorldTy" ppType (TyApp "ThreadId#" []) = "threadIdPrimTy" ppType (TyApp "ForeignObj#" []) = "foreignObjPrimTy" ppType (TyApp "BCO#" []) = "bcoPrimTy" -ppType (TyApp "Unit" []) = "unitTy" -- dodgy +ppType (TyApp "()" []) = "unitTy" -- unitTy is TysWiredIn's name for () ppType (TyVar "a") = "alphaTy" @@ -642,7 +647,7 @@ ppT = alts [apply TyVar pTyvar, ] pTyvar = sat (`notElem` ["section","primop","with"]) pName -pTycon = pConstructor +pTycon = alts [pConstructor, lexeme (string "()")] pName = lexeme (then2 (:) lower (many isIdChar)) pConstructor = lexeme (then2 (:) upper (many isIdChar))