Changeset 20058

Show
Ignore:
Timestamp:
03/04/08 22:06:31 (9 months ago)
Author:
gbacon
Message:

Build the library, but the executable still doesn't link. Why aren't we building an Executable with cabal?

Files:
13 modified

Legend:

Unmodified
Added
Removed
  • Pugs.cabal.in

    r20057 r20058  
    2020Library 
    2121   if flag(small_base) 
    22         build-depends: base >= 3, containers, pretty, process, directory, random, array 
     22        build-depends: base >= 3, containers, pretty, process, 
     23                       directory, random, array, filepath, stm, 
     24                       bytestring >= 0.9.0.1, HsSyck, pugs-hsregex, 
     25                       time, mtl, parsec, network __DEPENDS__ 
    2326   else 
    2427        build-depends: base < 3 
    25    build-depends: pugs-hsregex, HsSyck, filepath, mtl, stm, parsec, network, haskell98, template-haskell, time, unix, readline, bytestring >= 0.9.0.1 __DEPENDS__ 
     28        build-depends: pugs-hsregex, HsSyck, filepath, mtl, stm, parsec, network, haskell98, template-haskell, time, unix, readline, bytestring >= 0.9.0.1, containers __DEPENDS__ 
    2629 
    2730   exposed-modules: Pugs Pugs.AST Pugs.AST.Internals Pugs.AST.Internals.Instances 
  • src/Pugs/AST.hs

    r19810 r20058  
    196196            merge _ old = case old of 
    197197                PEConstant{ pe_proto = MkRef (ICode oldCV) } 
    198                     | Just mc <- fromTypeable oldCV -> protoEntry 
     198                    | Just (mc :: VMultiCode) <- fromTypeable oldCV -> protoEntry 
    199199                        { pe_proto = MkRef . ICode $ protoCode 
    200200                            { mc_assoc      = code_assoc c `mappend` code_assoc mc 
     
    449449readCodesFromRef :: VRef -> Eval [VCode] 
    450450readCodesFromRef (MkRef (ICode c)) 
    451     | Just mc <- fromTypeable c = do 
     451    | Just (mc :: VMultiCode) <- fromTypeable c = do 
    452452        let names@(pivot:_) = Set.elems (mc_variants mc) 
    453453        rvs <- fmap concat . forM names $ \var -> do 
     
    460460                rvsGlobal <- readCodesFromRef =<< fromVal cvGlobal 
    461461                return (rvsGlobal ++ rvs) 
    462     | Just cv <- fromTypeable c = return [cv] 
     462    | Just (cv :: VCode) <- fromTypeable c = return [cv] 
    463463readCodesFromRef ref = do 
    464464    code <- fromVal =<< readRef ref 
  • src/Pugs/AST/Internals.hs

    r16627 r20058  
    20862086instance YAML VRef where 
    20872087    asYAML (MkRef (ICode cv)) 
    2088         | Just mc <- fromTypeable cv = do 
     2088        | Just (mc :: VMultiCode) <- fromTypeable cv = do 
    20892089            mcC <- asYAML (mc :: VMultiCode) 
    20902090            return $ mkTagNode (tagHs "VMultiCode") $ ESeq [mcC] 
  • src/Pugs/AST/Internals/Instances.hs

    r16627 r20058  
    115115instance YAML VRef where 
    116116    asYAML (MkRef (ICode cv)) 
    117         | Just mc <- fromTypeable cv = do 
     117        | Just (mc :: VMultiCode) <- fromTypeable cv = do 
    118118            mcC <- asYAML (mc :: VMultiCode) 
    119119            return $ mkTagNode (tagHs "VMultiCode") $ ESeq [mcC] 
  • src/Pugs/AST/Pad.hs

    r17047 r20058  
    8080    PEConstant{ pe_proto = MkRef (ICode newCV), pe_flags = flags } 
    8181    PEConstant{ pe_proto = MkRef (ICode oldCV) } 
    82     | Just newMC <- fromTypeable newCV 
    83     , Just oldMC <- fromTypeable oldCV 
     82    | Just (newMC :: VMultiCode) <- fromTypeable newCV 
     83    , Just (oldMC :: VMultiCode) <- fromTypeable oldCV 
    8484    = PEConstant 
    8585        { pe_type  = mc_type newMC -- XXX - Select a narrower type? 
  • src/Pugs/Compile.hs

    r17701 r20058  
    7474        where 
    7575        entries = sortBy padSort [ (cast var, readPadEntry ref) | (var, ref) <- padToList pad ] 
    76         canCompile (name@('&':_), sym) = do 
    77             ref <- sym 
     76        canCompile (name@('&':_) :: String, sym) = do 
     77            (ref :: VRef) <- sym 
    7878            case ref of 
    7979                MkRef ICode{} -> do 
  • src/Pugs/Compile/Pugs.hs

    r16627 r20058  
    2121 
    2222joinMany :: [Str] -> Str 
    23 joinMany xs = Str.join cm (filter (not . Str.null) xs) 
     23joinMany xs = Str.intercalate cm (filter (not . Str.null) xs) 
    2424 
    2525instance (Compile x) => Compile [x] where 
  • src/Pugs/Eval.hs

    r17873 r20058  
    185185evalRef ref = do 
    186186    if refType ref == (mkType "Thunk") then forceRef ref else do 
    187     val <- catchT $ \esc -> do 
     187    val <- catchT $ \(esc :: Val -> Eval ()) -> do 
    188188        MkEnv{ envContext = cxt, envLValue = lv } <- ask 
    189189        let typ = typeOfCxt cxt 
     
    281281            Nothing 
    282282                | SType <- sig      -> return . VType . cast $ if isQualifiedVar var 
    283                     then cast $ Buf.join (__"::") [cast pkg, cast name] 
     283                    then cast $ Buf.intercalate (__"::") [cast pkg, cast name] 
    284284                    else name 
    285285                | isGlobalVar var || pkg `notElem` [emptyPkg, callerPkg, outerPkg, contextPkg] -> do 
     
    14841484                    --- not scalarRef! -- use the new "transparent IType" thing! 
    14851485                    case showType (typeOfSigilVar var) of 
    1486                         "Hash"  -> ($ v) . fix $ \redo x -> case x of 
     1486                        "Hash"  -> ($ v) . fix $ \(redo :: Val -> Eval Val) x -> case x of 
    14871487                            VRef (MkRef (IHash h)) -> return (VRef $ hashRef h)  
    14881488                            VRef ref@(MkRef IScalar{}) -> redo =<< readRef ref 
    14891489                            _ -> fmap (VRef . hashRef) (fromVal v :: Eval VHash) 
    1490                         "Array" -> ($ v) . fix $ \redo x -> case x of 
     1490                        "Array" -> ($ v) . fix $ \(redo :: Val -> Eval Val) x -> case x of 
    14911491                            VRef (MkRef (IArray a)) -> return (VRef $ arrayRef a)  
    14921492                            VRef ref@(MkRef IScalar{}) -> redo =<< readRef ref 
  • src/Pugs/Internals/Cast.hs

    r15468 r20058  
    8282    castBack = UTF8.pack 
    8383 
     84instance ((:<:) ByteString) String where 
     85    castBack = UTF8.unpack 
     86 
    8487#endif 
  • src/Pugs/Internals/ID.hs

    r17047 r20058  
    8989    cast = cast . idBuf 
    9090 
     91instance ((:<:) String) ID where 
     92    castBack = cast 
     93 
    9194instance ((:<:) ID) ByteString where 
    9295    castBack = idBuf 
  • src/Pugs/Monads.hs

    r17044 r20058  
    252252recloseRef :: VRef -> STM VRef 
    253253recloseRef (MkRef (ICode cv)) 
    254     | Just vcode <- fromTypeable cv = do 
     254    | Just (vcode :: VCode) <- fromTypeable cv = do 
    255255        vcode'   <- recloseCode vcode 
    256256        return . MkRef . ICode $ vcode' 
  • src/Pugs/Parser/Operator.hs

    r19198 r20058  
    2727 
    2828newtype OpName = MkOpName ID 
    29     deriving (Show, Eq, Typeable, (:>:) String, (:>:) ByteString, (:<:) ByteString, (:>:) ID) 
     29    deriving (Show, Eq, Typeable, (:>:) String, (:>:) ByteString, (:<:) ByteString, (:>:) ID, (:<:) String, (:<:) ID) 
    3030 
    3131instance Ord OpName where 
    3232    compare (MkOpName MkID{ idKey = a, idBuf = x }) (MkOpName MkID{ idKey = b, idBuf = y }) 
    3333        = compare (Buf.length y) (Buf.length x) `mappend` compare b a 
     34 
     35instance ((:<:) OpName) ByteString where 
     36    castBack (MkOpName id) = castBack id 
    3437 
    3538-- Not yet transcribed into a full optable parser with dynamic precedence 
     
    650653            notFollowedBy (char '(' <|> (char ':' >> char ':')) 
    651654            possiblyApplyMacro $ App (Var var) Nothing [] 
    652         parseOneTerm (name, categ) = do 
     655        parseOneTerm (name :: OpName, categ) = do 
    653656            symbol (cast name) 
    654657            return MkVar 
  • util/build_pugs.pl

    r20057 r20058  
    458458    #system $ghc, '--make', @_, @o, '-o' => 'pugs', 'src/Main.hs'; 
    459459 
    460     $push_pkgs->(qw(stm network mtl template-haskell filepath base HsSyck pugs-hsregex)); 
     460    $push_pkgs->(qw{ 
     461        stm network   mtl         filepath  base     HsSyck 
     462        containers    bytestring  random    process  directory 
     463        time          array       pretty    parsec   template-haskell 
     464        pugs-hsregex 
     465    }); 
     466 
    461467    if ($^O =~ /(?:MSWin32|mingw|msys|cygwin)/) { 
    462468        $push_pkgs->('Win32'); 
     
    488494    unlink 'src/Main.o'; 
    489495    unlink 'src/Main.hi'; 
    490  
    491     $push_pkgs->('Pugs'); #"-$version"; 
    492496 
    493497    @_ = ('--make', @pkgs, qw(-optl-Lthird-party/installed -o ), "$out.new", qw( src/Main.hs ), @libs);