packages feed

purescript 0.5.2.2 → 0.5.2.3

raw patch · 5 files changed

+40/−13 lines, 5 filesPVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

API changes (from Hackage documentation)

+ Language.PureScript.TypeChecker.Monad: instance Alternative Check

Files

docgen/Main.hs view
@@ -116,10 +116,12 @@  isDctorExported :: P.ProperName -> Maybe [P.DeclarationRef] -> P.ProperName -> Bool isDctorExported _ Nothing _ = True-isDctorExported ident (Just exps) ctor = flip any exps $ \e -> case e of-  P.TypeRef ident' Nothing -> ident == ident'-  P.TypeRef ident' (Just ctors) -> ident == ident' && ctor `elem` ctors-  _ -> False+isDctorExported ident (Just exps) ctor = test `any` exps+  where+  test (P.PositionedDeclarationRef _ d) = test d+  test (P.TypeRef ident' Nothing) = ident == ident'+  test (P.TypeRef ident' (Just ctors)) = ident == ident' && ctor `elem` ctors+  test _ = False  renderTopLevel :: Maybe [P.DeclarationRef] -> [P.Declaration] -> Docs renderTopLevel exps decls = forM_ (sortBy (compare `on` getName) decls) $ \decl -> do@@ -133,20 +135,20 @@  renderDeclaration :: Int -> Maybe [P.DeclarationRef] -> P.Declaration -> Docs renderDeclaration n _ (P.TypeDeclaration ident ty) =-  atIndent n $ show ident ++ " :: " ++ P.prettyPrintType ty+  atIndent n $ show ident ++ " :: " ++ prettyPrintType' ty renderDeclaration n _ (P.ExternDeclaration _ ident _ ty) =-  atIndent n $ show ident ++ " :: " ++ P.prettyPrintType ty+  atIndent n $ show ident ++ " :: " ++ prettyPrintType' ty renderDeclaration n exps (P.DataDeclaration name args ctors) = do-  let typeName = P.runProperName name ++ " " ++ unwords args-  atIndent n $ "data " ++ typeName ++ " where"+  let typeName = P.runProperName name ++ (if null args then "" else " " ++ unwords args)   let exported = filter (isDctorExported name exps . fst) ctors+  atIndent n $ "data " ++ typeName ++ (if null exported then "" else " where")   forM_ exported $ \(ctor, tys) ->-    atIndent (n + 2) $ P.runProperName ctor ++ " :: " ++ concatMap (\ty -> P.prettyPrintType ty ++ " -> ") tys ++ typeName+    atIndent (n + 2) $ P.runProperName ctor ++ " :: " ++ concatMap (\ty -> prettyPrintType' ty ++ " -> ") tys ++ typeName renderDeclaration n _ (P.ExternDataDeclaration name kind) =   atIndent n $ "data " ++ P.runProperName name ++ " :: " ++ P.prettyPrintKind kind renderDeclaration n _ (P.TypeSynonymDeclaration name args ty) = do   let typeName = P.runProperName name ++ " " ++ unwords args-  atIndent n $ "type " ++ typeName ++ " = " ++ P.prettyPrintType ty+  atIndent n $ "type " ++ typeName ++ " = " ++ prettyPrintType' ty renderDeclaration n exps (P.TypeClassDeclaration name args implies ds) = do   let impliesText = case implies of                       [] -> ""@@ -161,6 +163,14 @@ renderDeclaration n exps (P.PositionedDeclaration _ d) =   renderDeclaration n exps d renderDeclaration _ _ _ = return ()++prettyPrintType' :: P.Type -> String+prettyPrintType' = P.prettyPrintType . P.everywhereOnTypes dePrim+  where+  dePrim ty@(P.TypeConstructor (P.Qualified _ name))+    | ty == P.tyBoolean || ty == P.tyNumber || ty == P.tyString = +      P.TypeConstructor $ P.Qualified Nothing name+  dePrim other = other  getName :: P.Declaration -> String getName (P.TypeDeclaration ident _) = show ident
prelude/prelude.purs view
@@ -154,6 +154,20 @@     a' <- a     return (f' a') +  instance functorArr :: Functor ((->) r) where+    (<$>) = (<<<)++  instance applyArr :: Apply ((->) r) where+    (<*>) f g x = f x (g x)++  instance applicativeArr :: Applicative ((->) r) where+    pure = const++  instance bindArr :: Bind ((->) r) where+    (>>=) m f x = f (m x) x++  instance monadArr :: Monad ((->) r)+   infixl 7 *   infixl 7 /   infixl 7 %@@ -442,6 +456,9 @@    instance semigroupString :: Semigroup String where     (<>) = concatString++  instance semigroupArr :: (Semigroup s') => Semigroup (s -> s') where+    (<>) f g = \x -> f x <> g x    infixr 5 ++ 
purescript.cabal view
@@ -1,5 +1,5 @@ name: purescript-version: 0.5.2.2+version: 0.5.2.3 cabal-version: >=1.8 build-type: Custom license: MIT
src/Language/PureScript/Pretty/JS.hs view
@@ -227,7 +227,6 @@                         ++ fromMaybe "" name                         ++ "(" ++ intercalate ", " args ++ ") "                         ++ ret ]-                  , [ Wrap conditional $ \(th, el) cond -> cond ++ " ? " ++ prettyPrintJS1 th ++ " : " ++ prettyPrintJS1 el ]                   , [ binary    LessThan             "<" ]                   , [ binary    LessThanOrEqualTo    "<=" ]                   , [ binary    GreaterThan          ">" ]@@ -252,4 +251,5 @@                   , [ binary    BitwiseOr            "|" ]                   , [ binary    And                  "&&" ]                   , [ binary    Or                   "||" ]+                  , [ Wrap conditional $ \(th, el) cond -> cond ++ " ? " ++ prettyPrintJS1 th ++ " : " ++ prettyPrintJS1 el ]                     ]
src/Language/PureScript/TypeChecker/Monad.hs view
@@ -136,7 +136,7 @@ -- The type checking monad, which provides the state of the type checker, and error reporting capabilities -- newtype Check a = Check { unCheck :: StateT CheckState (Either ErrorStack) a }-  deriving (Functor, Monad, Applicative, MonadPlus, MonadState CheckState, MonadError ErrorStack)+  deriving (Functor, Monad, Applicative, Alternative, MonadPlus, MonadState CheckState, MonadError ErrorStack)  -- | -- Get the current @Environment@