purescript 0.4.10 → 0.4.10.1
raw patch · 3 files changed
+10/−8 lines, 3 filesdep ~monad-unify
Dependency ranges changed: monad-unify
Files
- purescript.cabal +2/−2
- src/Language/PureScript/Sugar/Names.hs +6/−5
- src/Language/PureScript/TypeChecker/Types.hs +2/−1
purescript.cabal view
@@ -1,5 +1,5 @@ name: purescript-version: 0.4.10+version: 0.4.10.1 cabal-version: >=1.8 build-type: Custom license: MIT@@ -20,7 +20,7 @@ library build-depends: base >=4 && <5, cmdtheline -any, containers -any, directory -any, filepath -any, mtl -any, parsec -any, syb -any,- transformers -any, utf8-string -any, pattern-arrows -any, monad-unify >= 0.2 && < 0.3,+ transformers -any, utf8-string -any, pattern-arrows -any, monad-unify >= 0.2.1 && < 0.3, xdg-basedir -any, time -any if (!os(windows)) build-depends: unix -any
src/Language/PureScript/Sugar/Names.hs view
@@ -17,7 +17,7 @@ ) where import Data.Data-import Data.Maybe (fromMaybe, isJust)+import Data.Maybe (fromMaybe, isJust, mapMaybe) import Data.Generics (extM, mkM, everywhereM) import Data.Generics.Extras (mkS, extS, everywhereWithContextM') @@ -200,7 +200,7 @@ rethrowFor "declaration" name $ ValueDeclaration name nameKind [] Nothing <$> updateAll val' where bindFunctionArgs bound (Abs (Left arg) val') = return (arg : bound, Abs (Left arg) val')- bindFunctionArgs bound (Let ds val') = let args = map letBoundVariable ds in+ bindFunctionArgs bound (Let ds val') = let args = mapMaybe letBoundVariable ds in return (args ++ bound, Let ds val') bindFunctionArgs bound (Var name'@(Qualified Nothing ident)) | ident `notElem` bound = (,) bound <$> (Var <$> updateValueName name')@@ -214,10 +214,10 @@ bindBinders :: [Ident] -> CaseAlternative -> Either String ([Ident], CaseAlternative) bindBinders bound c@(CaseAlternative bs _ _) = return (binderNames bs ++ bound, c) - letBoundVariable :: Declaration -> Ident- letBoundVariable (ValueDeclaration ident _ _ _ _) = ident+ letBoundVariable :: Declaration -> Maybe Ident+ letBoundVariable (ValueDeclaration ident _ _ _ _) = Just ident letBoundVariable (PositionedDeclaration _ d) = letBoundVariable d- letBoundVariable _ = error "Invalid argument to letBoundVariable"+ letBoundVariable _ = Nothing go (ValueDeclaration name _ _ _ _) = error $ "Binders should have been desugared in " ++ show name go (ExternDeclaration fit name js ty) = rethrowFor "declaration" name $ ExternDeclaration <$> pure fit <*> pure name <*> pure js <*> updateType' ty@@ -448,4 +448,5 @@ if item `elem` exports then return item else throwError $ "Unable to find " ++ t ++ " '" ++ show (Qualified (Just importModule) item) ++ "'"+
src/Language/PureScript/TypeChecker/Types.hs view
@@ -585,7 +585,8 @@ inferLetBinding seen (ValueDeclaration ident nameKind [] Nothing val : rest) ret j = do valTy <- fresh Just moduleName <- checkCurrentModule <$> get- TypedValue _ val' valTy' <- bindNames (M.singleton (moduleName, ident) (valTy, nameKind)) $ infer val+ let dict = if isFunction val then M.singleton (moduleName, ident) (valTy, nameKind) else M.empty+ TypedValue _ val' valTy' <- bindNames dict $ infer val valTy =?= valTy' bindNames (M.singleton (moduleName, ident) (valTy', nameKind)) $ inferLetBinding (seen ++ [ValueDeclaration ident nameKind [] Nothing val']) rest ret j inferLetBinding seen (BindingGroupDeclaration ds : rest) ret j = do