packages feed

libcspm 0.2.0 → 0.2.1

raw patch · 11 files changed

+36/−15 lines, 11 files

Files

CHANGELOG.txt view
@@ -1,3 +1,11 @@+0.2.1 Thomas Gibson-Robinson <thomas.gibsonrobinson@gmail.com> 2012-01-18+    * Fixed a bug in the typechecker that prevented certain (uncommon)+      functions that took function arguments that were polymorphic in dot from+      being type checked.+    * Exposed ErrorMessages to allow clients to present them more usefully.+    * Added location information to renamer errors.+    * Made compatible with GHC 7.0.4.+ 0.2.0 Thomas Gibson-Robinson <thomas.gibsonrobinson@gmail.com> 2012-01-04     * Enhanced the evaluator:         * Dot is not handled correctly;
libcspm.cabal view
@@ -32,7 +32,7 @@     from @x.y.z@ to @x.y'.z'@) will not be backwards compatible, but should be     relatively easy to port to. Major changes (i.e. from @x.y.z@ to @x'.y'.z'@)     will not be backwards compatible and may include large API redesigns.-Version: 0.2.0+Version: 0.2.1 Extra-source-files:      README.md,     CHANGELOG.txt@@ -44,7 +44,7 @@ Source-repository this     type:     git     location: https://github.com/tomgr/libcspm-    tag: release-0.2.0+    tag: release-0.2.1  Library     Build-Depends:
src/CSPM.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-} -- | This module provides the main high-level interface to the library  -- functionality. It does this through a monadic interface, mainly due to the -- fact that several of the components require the use of the IO monad. It is
src/CSPM/Compiler/Events.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-} module CSPM.Compiler.Events (     Event(..),     EventSet
src/CSPM/Compiler/Map.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-} module CSPM.Compiler.Map (      Map,     lookup,
src/CSPM/Renamer.hs view
@@ -33,7 +33,8 @@ type RenameEnvironment = HM.HierarchicalMap UnRenamedName Name  data RenamerState = RenamerState {-        environment :: RenameEnvironment+        environment :: RenameEnvironment,+        srcSpan :: SrcSpan     }  type RenamerMonad = StateT RenamerState IO@@ -44,7 +45,8 @@     let bs = map (\b -> (UnQual (OccName (stringName b)), name b)) (builtins False)     return $ RenamerState {         -- We insert a new layer to allow builtins to be overridden-        environment = HM.newLayer (HM.updateMulti HM.new bs)+        environment = HM.newLayer (HM.updateMulti HM.new bs),+        srcSpan = Unknown     }  -- | Runs the renamer starting at the given state and returning the given state.@@ -80,6 +82,9 @@         environment = HM.update (environment st) rn n     }) +setSrcSpan :: SrcSpan -> RenamerMonad ()+setSrcSpan loc = modify (\ st -> st { srcSpan = loc })+ -- ********************** -- Renaming Class and basic instances @@ -94,7 +99,9 @@     rename Nothing = return Nothing  instance Renamable e1 e2 => Renamable (Annotated a e1) (Annotated a e2) where-    rename (An a b e) = rename e >>= return . An a b+    rename (An a b e) = do+        setSrcSpan a+        rename e >>= return . An a b  instance (Renamable e1 e2, Renamable e1' e2') => Renamable (e1, e1') (e2, e2') where     rename (a, b) = do@@ -273,8 +280,9 @@         nameLocMap =              concatMap (\(ns, d) -> [(n, loc d) | n <- ns])  (zip fvss aps)     +    loc <- gets srcSpan     if duped /= [] then-        throwSourceError (map (mkErrorMessage Unknown) (duplicatedDefinitionsMessage nameLocMap))+        throwSourceError (map (mkErrorMessage loc) (duplicatedDefinitionsMessage nameLocMap))     else return ()  -- | Rename a variable on the left hand side of a definition.@@ -285,9 +293,10 @@ renameVarRHS :: UnRenamedName -> RenamerMonad Name renameVarRHS n = do     mn <- lookupName n+    loc <- gets srcSpan     case mn of         Just x -> return x-        Nothing -> throwSourceError [mkErrorMessage Unknown (varNotInScopeMessage n)]+        Nothing -> throwSourceError [mkErrorMessage loc (varNotInScopeMessage n)]  renameFields :: [PField] -> RenamerMonad a -> RenamerMonad ([TCField], a) renameFields fs inner = do
src/CSPM/TypeChecker/Decl.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, TypeSynonymInstances #-} module CSPM.TypeChecker.Decl (typeCheckDecls) where  import Control.Monad
src/CSPM/TypeChecker/Expr.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, TypeSynonymInstances #-} module CSPM.TypeChecker.Expr () where  import Control.Monad
src/CSPM/TypeChecker/Pat.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, TypeSynonymInstances #-} module CSPM.TypeChecker.Pat () where  import CSPM.DataStructures.Names
src/CSPM/TypeChecker/Unification.hs view
@@ -546,6 +546,10 @@ evaluateDots (TSet t) = evaluateDots t >>= return . TSet evaluateDots (TSeq t) = evaluateDots t >>= return . TSeq evaluateDots (TTuple ts) = mapM evaluateDots ts >>= return . TTuple+evaluateDots (TFunction t1 t2) = do+    t1' <- mapM evaluateDots t1+    t2' <- evaluateDots t2+    return $ TFunction t1' t2' evaluateDots t = do     ts <- typeToDotList t     ts <- mapM (\t -> compress t >>= return . toNormalForm) ts
src/Util/Exception.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE DeriveDataTypeable, FlexibleInstances #-}+{-# LANGUAGE DeriveDataTypeable, FlexibleInstances, TypeSynonymInstances #-} module Util.Exception (     Exception,     LibCSPMException(..),@@ -6,7 +6,7 @@     MonadIOException(..),     panic, throwSourceError,     mkErrorMessage, mkWarningMessage, -    ErrorMessage, ErrorMessages,+    ErrorMessage(..), ErrorMessages, ) where